I am attempting to create a stylish border for the .navbar-collapse element, but unfortunately, my efforts have been unsuccessful so far

I need assistance with adding a border around my mobile drop-down menu. I've tried using .navbar-collapse but it's not working. Any suggestions?

Here is a sample image of the mobile size:

Below is my code:

<nav class="navbar navbar-default navbar-fixed-top">
    <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span>
 <span class="icon-bar"></span>
 <span class="icon-bar"></span>
 <span class="icon-bar"></span>

        </button>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
        <ul class="nav navbar-nav">
            <li class="active"><a href="#">I am fouridine</a>
            </li>
            <li><a href="#about">design</a>
            </li>
            <li><a href="#contact">animation</a>
            </li>
            <li><a href="#">other art</a>
            </li>
            <li><a href="#">contact</a>
            </li>
        </ul>
        </ul>
    </div>
    <!--/.nav-collapse -->
</nav>

The CSS for the navigation is as follows:

@media (min-width: 768px) {
    .navbar {
        display: none;
    }
}
.navbar {
    min-height:0;
}
.navbar-nav {
    margin:0;
}
/* Remaining CSS rules... */

Answer №1

Applying this code to the navbar-nav class will give you the desired styling effect. For more information, refer to the MDN documentation on border-width

@media (max-width: 767px) {
    .navbar.navbar-default .navbar-nav {
      background-color: white;
      border: none;
      margin-top: 0px;
      border: solid #47c4c0;
      border-width: 0 30px 30px;
    }
}

To see a live example of this code in action, check out the Snippet below.

@media (min-width: 768px) {
  .navbar.navbar-default {
    display: none;
  }
}
.navbar.navbar-default {
  min-height: 0;
  background-color: #fff;
  border: 0;
  height: 30px;
  font-size: 16px;
}
.navbar.navbar-default .navbar-nav > li > a {
  padding: 5px 20px;
  color: #47c4c0;
}
.navbar.navbar-default .navbar-nav > li > a:hover,
.navbar.navbar-default .navbar-nav > li > a:focus {
  color: #666666;
}
.navbar.navbar-default .navbar-nav > .active > a,
.navbar.navbar-default .navbar-nav > .active > a:hover,
.navbar.navbar-default .navbar-nav > .active > a:focus {
  color: white;
  background-color: #47c4c0;
}
.navbar.navbar-default .navbar-collapse,
.navbar.navbar-default .navbar-form {
  border: none;
}
@media (max-width: 767px) {
  .navbar.navbar-default {
    background-color: #47c4c0;
  }
  .navbar.navbar-default .navbar-toggle {
    padding: 8px;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .navbar.navbar-default .navbar-toggle .icon-bar {
    width: 15px;
    background-color: white;
  }
  .navbar.navbar-default .navbar-toggle:hover .icon-bar,
  .navbar.navbar-default .navbar-toggle:focus .icon-bar {
    background-color: #47c4c0;
  }
  .navbar.navbar-default .navbar-toggle:hover,
  .navbar.navbar-default .navbar-toggle:focus {
    background-color: white;
  }
  .navbar.navbar-default .navbar-nav {
    background-color: white;
    border: none;
    margin-top: 0px;
    border: solid #47c4c0;
    border-width: 0 30px 30px;
  }
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-default navbar-fixed-top">
  <div class="navbar-header">
    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>

    </button>
  </div>
  <div id="navbar" class="navbar-collapse collapse">
    <ul class="nav navbar-nav">
      <li class="active"><a href="#">I am fouridine</a>

      </li>
      <li><a href="#about">design</a>

      </li>
      <li><a href="#contact">animation</a>

      </li>
      <li><a href="#">other art</a>

      </li>
      <li><a href="#">contact</a>

      </li>
    </ul>
    </ul>
  </div>
</nav>

Answer №2

border:0 30px 30px 30px solid blue; // or any other color of your choice

solid is used to specify the type of border, options include dotted, dashed, double, groove, ridge

Feel free to select the color that suits your design

http://www.example.com/cssref/pr_border-style.asp

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the process for calling a class in HTML from a <Div> tag?

I am struggling with the following code snippet: <p class=‘majed’ style="color:#FF0000";>Red paragraph text</p> How can I reference the 'majed' class above? <Div class=‘majed’ > </Div> Your help is greatly appr ...

Capture audio using a web browser

Currently working on a project to create a platform for recording sounds. I'm aiming to incorporate a meter that measures the volume of the sound. Despite extensive research, I haven't been able to discover an HTML5 solution compatible with all b ...

What could be causing my table to not display?

I imported a CSV file with data on time, events, and location. The data was loaded into separate arrays for each column. I attempted to display the arrays as an HTML table using a for loop, but the table is not showing up. What could be causing this issue? ...

Determine the number of input tags within a div element by utilizing the closest property in jQuery

Sorry for the silly question, but I've been struggling to find a solution. Spent hours scratching my head. Here is my HTML structure: <div class= 'container'> <div class="someclass"> <input>some content</in ...

Placing a Div wrapper around the contents of two corresponding elements

I am currently attempting to wrap a div with the class name 'wrapped' around two other divs containing innerHTML of 'one' and 'two'. <div class='blk'>one</div> <div class='blk'>two</di ...

Get notified via email when submitting a form on a PHP contact form

I am a front-end developer and do not have experience with PHP. I am trying to set up a contact form on my website using an example from htmldog. Here is the current code snippet: <form action="contact.php" method="post"> <div class="c ...

Tips for changing form field values using jQuery

Is there a way to use jQuery to retrieve the values of multiple checkboxes and insert them into a hidden form field? Here is how my checkboxes are structured: <form> <input type="checkbox" name="chicken" id="chicken" />Chicken <in ...

What methods can I use to identify my current page location and update it on my navigation bar accordingly?

My latest project involves a fixed sidebar navigation with 3 divs designed to resemble dots, each corresponding to a different section of my webpage. These sections are set to occupy the full height of the viewport. Now, I'm facing the challenge of de ...

Div sliding out of view

I'm encountering a slight issue with this template: essentially, my goal is to implement a feature where clicking on a box will expand it while simultaneously sliding the other boxes off-screen. However, instead of just sliding the div off-screen, it ...

What is the best way to define a:link style within a div class structure?

I am trying to include an anchor tag within my HTML... Inside the tag, I have the following CSS code: .foo { white-space:nowrap; text-shadow: 0 -1px 0 #000; color: #000; font-family: Helvetica Neue, Helvetica, arial; font-size: ...

Having trouble with the Ng multiselect dropdown displaying empty options?

I'm currently facing a challenge in adding a multiselect dropdown feature to my project. Below is the code I have been working on: HTML <ng-multiselect-dropdown [settings]="searchSettings" [data]="dummyList" multiple> </n ...

Unable to render canvas element

Hey guys, I'm trying to display a red ball on the frame using this function but it's not working. I watched a tutorial and followed the steps exactly, but I can't seem to figure out what's wrong. Can someone please help me with this? I ...

Nesting maps in JavaScript is a powerful way to transform

I'm in the process of developing a budgeting app using React and JavaScript. At the moment, I have successfully generated a table displaying various costs. Name Budget Used $ Used % Available Food 300 300 100 0 Streaming services 600 600 100 ...

uncovering the precise text match with the help of Beautifulsoup

I am looking to retrieve the precise matching value of text from HTML using Beautiful Soup. However, I am encountering some similar text along with my desired exact match. Here is my code: from bs4 import BeautifulSoup import urllib2enter code here url="h ...

Step-by-step guide on permanently updating the text of select options with JavaScript

Here is the code for a select option with different values: <select id="test" onchange="changeContent()"> <option>1</option> <option>2</option> <option>3</option> </select> The javascript function that chan ...

Tips for navigating through a div with an unknown height

I am currently working on developing a sleek messaging system and I have encountered an issue with the interface design. My project is built using Materialize, however, I am open to tweaking it with custom CSS if necessary. The layout consists of a list of ...

CSS: Struggling with Div Alignment

Here is a visual representation of the issue I am facing: View the screenshot of the rendered page here: http://cl.ly/image/0E2N1W1m420V/Image%202012-07-22%20at%203.25.44%20PM.png The first problem I have encountered is the excessive empty space between ...

Combining the Power of Bootstrap with Yii Framework

As a newcomer to the Yii framework, I am looking to incorporate my Bootstrap design into this platform. One issue I have encountered is related to my custom CSS. In Bootstrap, we use navbar-default for styling the navbar. I customized my navbar color by ...

Display the same DIV element across various HTML tabs

When two different tabs are clicked, I need to display a set of 10 Search Fields. Both tabs have the same fields, so instead of using separate DIVs, I want to use the same DIV and only change the AJAX REST End-Point based on the selected TAB. Can someone ...

Animate the centering of a DIV

Currently, I am working on an animation featuring a series of DIV's contained within a div with the identifier id="wrapper", all styled using CSS3. However, when I hover over the rounded box, the animation is not properly aligned in the center. You ca ...