Spread out the menu horizontally across the entire page

Hey everyone, I'm having an issue with my menu:

https://i.sstatic.net/kPcP3.png

I'm trying to make the menu fill horizontally across the entire page, but it's only filling part of it. Could it be because I'm using the wrong bootstrap classes? If anyone has any tips or advice on how to fix this, please let me know!

ul {
  list-style-type: none;
  border-bottom-style: solid;
  border-bottom-color: green;
  position: relative;
}
li {
  display: inline;
  padding: 30px;
}
#menu a {
  color: black;
}
#menu a:hover {
  color: green;
  font-weight: 700;
  text-decoration: none;
  border-bottom-style: solid;
  border-bottom-color: green;
  border-bottom-width: 6px;
  border-radius: 4px;
}
<body>
  <section>
    <div class="navbar navbar-default" role="navigation">
      <div class="container-fluid wrapper">
        <div class="navbar-header">
          <ul id="menu">
            <div class="row">
              <div class="col-md-12">
                <li><img src="Imagens/Logo.png"></li>
                <li id="menu1"><a href="#">About us</a></li>
                <li><a href="#"> Act</a></li>
                <li><a href="#"> News</a></li>
                <li><a href="#"> Videos</a></li>
                <li><a href="#"> Contact us</a></li>
              </div>
            </div>
          </ul>
        </div>
      </div>
    </div>
  </section>
</body>

Answer №1

While I may not be a Bootstrap expert, I discovered that removing the

<div class="navbar-header"></div>
element allowed my page to work properly in Chromium.

Using Chrome's Developer Tools can help identify and fix issues like this (Ctrl+Shift+I or Ctrl+Shift+C to access the Element Inspector directly).

You might consider adding style="text-align: justify"; to the wrapping div around your <li> tags to adjust the spacing between menu entries dynamically.

I hope this suggestion proves helpful for you.

Answer №2

If you want to make the navbar-header cover the full length horizontally, you can set its width to 100% using the code snippet below. Keep in mind that this may not result in a perfectly functional navbar.

.navbar-header{
  width:100%
}

It seems like you are trying to use a Bootstrap 3 navbar with Bootstrap 4, which is why it's not working as expected. The classes differ between the two versions.

For examples on how to implement a Bootstrap 4 navbar, refer to http://getbootstrap.com/docs/4.0/examples/navbars/.

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

I am having trouble getting my media query to function correctly

I am currently troubleshooting an issue with my media query in a project. The media query is set for a screen width of 768px, but it appears to not be working as expected. Interestingly enough, when I resize my screen to 360px, the media query does work. ...

JavaScript - Issues with Cookie Setting

I created a function for setting cookies: function storeCookie(cname, cvalue, exdays){ var d = new Date(); d.setTime(d.getTime() + (1000*60*60*24*exdays)); var expires = "expires="+d.toGMTString(); document.cookie = cname + "=" + cvalue + ...

Tips for choosing items showcased in Grid view results

<DIV class=x-grid3-scroller id=ext-gen742> <DIV class=x-grid3-body id=ext-gen743> <DIV class=x-grid3-row x-grid3-row-first x-grid3-row-last > <TABLE class=x-grid3-row-table> <TBODY> <TR> <TD> class=x-grid3-col x-g ...

The Bootstrap navigation bar is experiencing issues and is not functioning properly, as the classes are not

<nav class="navbar navbar-default"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" d ...

Displaying "Loading..." with jQuery in Bootstrap 4 while utilizing the data-loading-text feature

I am attempting to create a loading effect for a button, similar to the example shown on codepen. My project utilizes bootstrap 4 (beta 2) and Jquery 3.2.1. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> &l ...

Arrange divs next to each other using CSS

I am currently working with a basic layout on my webpage <div id="content-wrap"> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div ...

Issues with Hovering over Button Contained in Slider

I can't seem to figure this out. It should be a simple fix. I have 5 slider images with black buttons that link to different galleries. I want the button background color to change on hover, but it's only working on one of the sliders. It seems ...

What is the best way to cycle through the data within the Django template system?

On my blog page, I'm attempting to implement a feature where clicking on the blog title or read more link will redirect and display the detailed contents of the blogs. Model class Blog(models.Model): title = models.CharField(max_length=200) c ...

Issue with Edge browser: child element exceeds parent's defined width

We need to meet a specific requirement that involves displaying a prefix inside a textbox that cannot be edited. Check out the HTML/CSS code on JSFiddle. The issue arises when we resize the window. HTML: <div class="customNameContainer" dir="ltr"> ...

I am encountering a problem when trying to implement fancybox with Bootstrap 4

This is the code I have: <section class="call-to-action text-white text-center" id="Productos"> <div class="overlay"></div> <div class="container"> <div class="col-xl-9 mx-auto"> <h2 class="mb-4">Productos</h2> &l ...

Exploring user inputs and displaying variables using JavaScript and HTML 4.01

I was testing some code and I'm facing an issue that I can't figure out: <HTML> <head> <title> Page 1 </title> <script> function myFunction() { var x=document.getElementById("myEmail") document.write(x) } </scr ...

Adjust background color on click using JavaScript

Could someone provide me with the JavaScript code to change the background color of a page from blue to green when a button is clicked? I have seen this feature on many websites but haven't been able to write the code myself. I am specifically lo ...

What's the most effective way to constrain focus within a Modal Component?

Currently working on a library of components in Angular 8, one of the components being a modal that displays a window dialog. The goal is to prevent focus from moving outside the modal so that users can only focus on the buttons inside by using the Tab but ...

Update the variables upon a click event following the completion of an AJAX request

Despite my efforts, I am unable to find a solution to the issue I am currently facing. To address this problem, I have created a script using PHP and jQuery that enables users to promote their "listings" on my website. When users visit a specific page, the ...

Unable to locate and interact with element using CSS Selector in the webdriver

I am having trouble locating the element that contains both "Confirm" and "Cancel" without using Xpath. Can anyone suggest a better approach to find this element? Below is the HTML code snippet: <div class="ui-dialog-buttonpane ui-widget-content ui- ...

Tips for using jQuery dropdown menus

I am currently in the process of creating a prototype for a quick dropdown menu using jQuery. However, I have reached the limits of my knowledge on jQuery and could use some assistance in solving my issue. My objective is to have a dropdown animate down w ...

Correcting CSS to ensure alignment of container-fluid container

Having trouble aligning the login box to the center of the page. Any suggestions on how to achieve this? https://i.sstatic.net/3AFoL.png The following code attempts to achieve center alignment using Bootstrap 4.x base_nologin.html <!DOCTYPE html> ...

Troubleshooting a problem with CSS styling in a jQuery bounce effect

In my current project, I am experimenting with creating a unique 'hovering' link. When the user hovers over an image and then moves the mouse away, I want the link to 'jump' back instead of using jQuery animation. +-----------+ | I ...

An issue was encountered while attempting to upload a file in PHP (specifically an image

I want to start by apologizing for adding another question on this topic as I know it has been discussed before. However, I have not been able to find a solution that addresses my specific problem. Therefore, I am hoping that someone can help me resolve th ...

Image carousel with variable height

I'm attempting to implement a slide show of images with previous and next functionality. When the user clicks "previous," I want the images to slide to the left, and when they click "next," I want the images to slide to the right with a 0.5 second del ...