Utilizing Bootstrap framework to create a user-friendly navigation bar with dropdown functionality for a seamlessly organized and visually appealing full

Looking to utilize bootstrap for creating a top navigation layout and encountering an issue with the default left alignment. How can I make it span the full width at the top?

Current https://jsfiddle.net/v2notb5n/


    <nav class="navbar">

<div class="fluid-container">
<ul class="nav navbar-nav navbar-inverse">
<li class="nav_page active"><a href="#" class="nav_txt"> Home</a> </li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#" class="nav_txt"> Team <span class="caret"></span></a></li>
<ul class="dropdown-menu">
                        <li><a href="#">National</a></li>
                        <li><a href="#">Geo</a></li>
                        <li><a href="#">Team Pictures</a></li>
                  </ul>
<li> <a href="#" class="nav_txt">About us</a> <li>
</ul>
</div>

</nav>

Expected outcome: https://i.sstatic.net/7h8th.jpg

I attempted a similar solution I found here Bootstrap navbar justify / span menu items occupying full width

However, that approach didn't solve my issue.

Updated with suggestions and answer from: https://jsfiddle.net/uahwra75/1/

Answer №1

If you want the navbar to span the entire width, simply replace the float: left with .navbar-nav for medium screen sizes and larger, like so:

@media screen and (min-width: 768px) {
  .navbar-nav {
    float: none;
  }
}

I've provided a working example in this link.

It should be noted that you used the incorrect class fluid-container instead of container-fluid, affecting padding. I've addressed this correction in the fiddle above and the code snippet below:

EDIT

To ensure the titles are centered, add a width to .navbar-nav li that is 100% divided by the number of columns. With three columns, divide by three:

.navbar-nav li {
  width: calc(100% / 3);
}

Remember, this adjustment also goes inside the media query.

I've updated the fiddle with these changes here.

Hope this information proves helpful! :)

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

Using Node.js to Send Emails via API

I've been grappling with an issue for over a week while trying to develop a web application that sends welcome emails to new subscribers. Despite my API code working perfectly, I cannot seem to get any output on the console indicating success or failu ...

Aligning floating elements in the center

Presently, I am working with the following code... <!DOCTYPE html> <html> <head> <title>Test</title> <meta charset="UTF-8" /> <link href="verna.css" type="text/css" rel="stylesheet" /> </head> ...

A chart using JavaScript that displays text values instead of a traditional website

I am a student with no background in programming, however, for my project I need to create a chart based on values from a txt file to display sensor data. I came across a chart that retrieves its values from a website, but I would like to modify it so it c ...

Incorporating interactive maps into an AngularJS web application

I've been attempting to integrate Google Maps into my AngularJS application, using the script tag below: <script src="https://maps.googleapis.com/maps/api/js?key=[MySecretKeyHere]&callback=initMap" async defer></script> I found this ...

Utilize ajaxFileUpload.js to upload 3 images from various input type files in CodeIgniter effortlessly

I'm looking to enhance my code by enabling the upload of three images from different input types along with a text field using a single submit button function. The current code works fine when uploading only one file, but issues arise when attempting ...

Achieve a responsive layout by dynamically sizing child div elements to fill their parent container using percentage-based margins and

I'm having trouble getting the child divs to stretch to the parent, and I'm not sure if I need to specify a % width on #fullpage-content even though #middle is set to 76%. I seem to have forgotten... Would you like to check out this link where c ...

The specified 'image' identifier has not been defined. There is no such member within 'never'

Edit :: Finally, I managed to get the output successfully, but there's still an error that baffles me. https://i.stack.imgur.com/2wrNM.pngAlthough I've tackled similar issues in the past, this particular one seems elusive. I attempted using "?", ...

Is anyone experiencing difficulties with IOS 8.3 when trying to assign colors to Font Awesome icons using content?

I'm encountering an issue on IOS 8.3 where I click a checkbox and the arrow color should be green, but it shows up as black instead. Is there a bug fix for this in IOS or is it simply not supported? Here is my SASS/css code: input[type="checkbox"] ...

Angular 6 - detecting clicks outside of a menu

Currently, I am working on implementing a click event to close my aside menu. I have already created an example using jQuery, but I want to achieve the same result without using jQuery and without direct access to the 'menu' variable. Can someon ...

Tailwind.css - a "sticky" element is positioned outside of the parent "wrapper" element

Seeking your kind assistance. I am facing an issue where a fixed element is being displayed outside the parent container on large screens, as it is treated as "fixed" from the viewport rather than relative to its parent element. https://i.sstatic.net/mw2 ...

Unable to choose the div element with id ":1"

Just starting out with web development, and I have a div element with the following attributes: <div class="" id=":1" role="treeitem" aria-selected="false" aria-expanded="false" aria-level="1" aria-labelledby=":1.label" aria-setsize="10" aria-posinset= ...

Attempting to reduce the width of the dig when it reaches 400

I have a square element with a click event that increases its size by 50 pixels on each click. However, once it reaches a size of 400 pixels, the size decreases by 50 pixels with every click instead. Additionally, when the size of the square reaches 100 p ...

Tips on maintaining the Parent menu in a hovered state when the mouse is over the child menu within a Dropdown Menu

I have been working on creating a dropdown menu that functions correctly. However, I am facing an issue where the top menu, when hovered, turns white, but as soon as I move down to the submenus, the top menu reverts back to its original color. Is there a ...

Unable to modify the color of UML state elements within JointJS

I need some help with jointjs as I am in the process of adjusting the color of a UML state diagram graph using this command: graph.getElements()[4].attributes.attrs[".uml-state-body"]["fill"] = "#ff0000"; However, despite trying this, the color of the st ...

Why are all links broken and the mobile menu disappeared after installing featherbox gallery?

If you want to see for yourself, here is the link. I can't figure out why my website has suddenly lost functionality on this specific page. None of the links work, except for the home and contact (the non-expandable ones). The navigation menu seems ...

Is it achievable to generate multiple `div` elements that are positioned in a circular arrangement?

Is it possible to create a button that, when clicked, displays a circular zone div using CSS only? It should look like this: https://i.sstatic.net/BFFs1.png I would like the red div to look like the image above. Can this be accomplished with CSS alone? ...

Guide to populating a dropdown list using an array in TypeScript

I'm working on a project where I have a dropdown menu in my HTML file and an array of objects in my TypeScript file that I am fetching from an API. What is the best approach for populating the dropdown with the data from the array? ...

Switching the color of the placeholder text on a credit card

Recently, I have integrated credit card payment options into this website. To access the checkout page, you may need to add an item to your shopping cart first. Below, you will find the section where users can enter their credit card details. As part of ...

Image or Surface at the Front for Textural Effect

Looking for a way to add a background image layer on text using JS/CSS. Any solutions available? For example ...

Dynamically adjust the label position based on the button position

I am currently developing an interface that allows users to change the position of buttons and add a label text under the button. However, I am facing an issue where the label is not always centered below the button due to variations in the size and number ...