The secondary ul in the Boostrap navigation is not reacting to the custom CSS borders as expected

I am currently facing an issue with my bootstrap navigation related to the border-bottom: **attribute** when it comes to a secondary ul in a drop-down menu.

My goal is to apply

border-bottom: medium black solid
or something similar to the visible part of the navigation (home, pages, quick links, etc), but not to the drop-down menus. I have attempted various custom CSS approaches, including using the :not() selector and other pseudo-classes, without success.

Here is a basic outline of the structure:

<ul class="nav navbar-nav navbar-right">
    <li class="active">
        <a href="#">
<span class="glyphicon glyphicon-home" aria-hidden="true"></span><span class="sr-only">(current)</span></a>
    </li>
                    <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Pages<span class="caret"></span></a>

                        <ul class="dropdown-menu" role="menu">
                            <li><a href="#">Primary</a>
                            </li>
                            <li><a href="#">Secondary</a>
                            </li>
                            <li><a href="#">Link</a>
                            </li>
                            <li class="divider"></li>
                            <li><a href="#">Link</a>
                            </li>
                            <li><a href="#">Link</a>
                            </li>
                        </ul>


https://jsfiddle.net/meh/r6byr9td/ To see the expanded navigation, move the JavaScript section to the left or view in full screen.

Answer №1

To achieve the desired outcome, you must focus on specifying the precise element. ul.nav > li

ul.nav > li {
  border-bottom: medium black solid;
}

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

confirming the integrity of a form that is initially concealed through the use of

Having an issue with my hidden form validation using jQuery. Despite the fields being empty, the form is still submitted. $(document).ready(function () { jQuery("#name").validate({ expression: "if (VAL) return true; else return false;", ...

The JavaScript code for summing two numbers is not functioning as expected

My HTML code takes a user input number, performs a calculation using a formula, and displays the output. The chosen input is inserted into the formula, and the result is added to the original number. However, there seems to be an issue with adding decimal ...

Exploring ways to cycle through dynamically loaded checkboxes with AJAX?

I'm looking to apply a similar function to checkboxes that are loaded dynamically via AJAX: $('input:checkbox').each(function() { $(this).hide(); alert("hi"); $('<div class="checkbox-fx"><div class="che ...

Preventing duplicate Google indexing with .htaccess

I have a website that utilizes a RewriteRule in the root directory to direct queries in this format: http://domain.com/foo/parameter to http://domain.com/index.php?args=parameter Visitors only see the clean URL and everything works smoothly. However, ...

Opt for filling background image instead of stretching it when the screen is resized

My background image resizes with the screen height but stretches when I change the width. The content that should appear below it completely covers the image. This is my current code: HTML: <div id="bg"> <img src="http://placehold.it/2560x1 ...

Setting the maximum width for a JavaScript pop-up box

Below is the html code that creates a link reading "sacola de compras" <div> <script type="text/javascript" src="https://app.ecwid.com/script.js?4549118"></script> <script type="text/javascript"> xMinicart("style=","layout=Mini") ...

Is CSS General sibling selector not functioning properly when used with :focus?

How can I display text that turns into an input form when hovered over, and stays visible even if it's unhovered but the user is interacting with the input form? The issue is that when the input form is focused while unhovered, both the input form an ...

Maintain HTML formatting when page is refreshed

I am new to HTML and JavaScript, and I'm trying to modify the JavaScript code below so that when I reload the page, it retains the most recent active tab instead of defaulting back to the first tab. Currently, if I click on the second tab for "Paris" ...

I'm having trouble with my code not fitting all screen resolutions. I usually code on a Macbook, but recently switched to a Windows computer and now everything is out of whack

$(function(){ $("#Welcome").typed({ strings: ["PROGRAMMERS / NETWORKERS"], typeSpeed: 60 }); }); html { background-color: mintcream; background-size: 100%; } /* Home */ .homeheader button { background-color: #4CAF450; top: ...

What is the best way to ensure items are aligned to the top of the navbar as a picture is enlarged?

I have searched through various similar questions, but none of them have provided a solution to my specific issue. I have attempted multiple suggestions, but none have been successful. (I am working with bootstrap4) Here is the html code I am using: < ...

Has the static content (such as .css and .js files) being transmitted from my server been compressed using gzip?

While crafting my initial query, I stumbled upon this insightful post. After deploying my site and enabling static content compression, I was still met with the same response. 1st Attempt 2nd Attempt I noticed a decrease in response size. Curiously, de ...

What is the method to retrieve the file name when a user chooses a file using <input type="file" />?

In the past, I've encountered similar inquiries that have remained unresolved due to security concerns. However, I recently discovered that HostMonster has effectively tackled this issue when I submitted a ticket and attached a file through their bac ...

Can you identify the specific name of the IE CSS bug affecting double vertical padding?

(Just when I thought I've encountered all the strange IE CSS bugs, here comes another one. Is there a name for this double-vertical-padding bug?) After creating a simple test case that worked perfectly in browsers like FF and Opera, I was surprised t ...

How can I move one of the multiple input fields to the top right side?

I am facing an issue and need some assistance. I have created a page with multiple font controls, but in my prototype design, there is a field on the right side where the inputs are positioned at the top and on the right. How can I achieve this? I have cr ...

Unidentified event listener

I am currently facing an issue where I keep getting the error message "addEventListerner of null" even though I have added a window.onload function. The page loads fine initially but then the error reoccurs, indicating that the eventListener is null. Str ...

What is the process for invoking a server-side Java function from HTML with JavaScript?

Can someone help me figure out the best way to invoke a Java method from HTML (I'm working with HTML5) using JavaScript? I attempted using Applets but that approach didn't yield any results. My goal is to extract the value from a drop-down menu i ...

Displaying a static image on an HTML5 canvas without any movement

As a novice in canvas game development, I must apologize for my lack of knowledge. I have an image with dimensions 2048px width and 1536px height that needs to be placed within a canvas (the width and height vary on different devices). While I am able to ...

A Step-by-Step Guide on Adding Content After the Bootstrap Slider Using Absolute Position

Check out my project here: I'm currently working on a bootstrap carousel that has absolute positioning and a z-index of -1. However, I'm facing an issue where I can't figure out how to place a div right after the carousel. I've tried s ...

What is the best method for implementing a file upload feature using jQuery and php?

Could someone explain how to create a jQuery multiple image upload feature (uploading without refreshing the page after choosing a file, only displaying the image but not inserting it into a database), and submit additional form data along with all images ...

What is the best way to incorporate jQuery for fading in server controls?

When a click event is triggered in the Code Behind, I have two webform panels that are displayed or hidden accordingly. The initial setup looks like this: pnlStepOne.Visible = true; pnlStepTwo.Visible = false; Upon clicking a button (#btnStepOne), the vi ...