Struggling to perfectly center the NavBar within the wrap container

After working on my navbar and utilizing this site for guidance, I was able to center it using text align. However, there is an odd indent in the navbar that I can't seem to figure out. This indentation throws off the alignment when centered, giving it an awkward appearance.

Any tips on removing this mysterious indent and properly centering the navbar? I'm fairly new to this, so any advice would be greatly appreciated. Thank you!

http://jsfiddle.net/f2eNm/

HTML

<div class="links_container">
  <div class="nav1">
  <ul>
    <li><a href="#" class="noBorder leftedge">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Challenges</a></li>
    <li><a href="#">Progress</a></li>
    <li><a href="#" class="rightedge">Forum</a></li>
  </ul>
  </div>

</div>

CSS

*{
margin:0;
}
.links_container {
    width: 100%;
    height: 25px;
    background-color: #33C4AB;
    margin-right: auto;
    margin-left: auto;
    border-bottom-style: double;
    border-bottom-width: 2px;
    border-color: #000000;
    position: absolute;
    max-width: 1000px;
}
.nav1 {
    display: inline;
    float: left;
}
.nav1 ul li {
    list-style-type: none;
    float: left;
    display: block;
}
.nav1 ul li a {
    color: #FFFFFF;
    text-decoration: none;
    background-color: #333333;
    display: inherit;
    height: 25px;
    width: 100px;
    text-align: center;
    line-height: 25px;
    border-left: thin solid #CCCCCC;
}
.noBorder {
    border-left-style: none !important;
}
.nav1 ul li a:hover {
    background-color: #6B6B6B;
}
.leftedge {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}
.rightedge {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

Answer №1

You should consider making some adjustments.

.nav1
{
    text-align: center;
}

.nav1 ul {
    margin: 0;
    padding: 0;
    display: inline-block;
    overflow: hidden;
}

Check out this link for more details.

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

ways to set a background color for a textarea element using bootstrap

How can I add a background color to my text area field in Bootstrap? <div class="form-group"> <div class="col-xs-12"> <textarea class="form-control" id="exampleTextarea" rows="6" placeholder="Message" style="background-color: #f ...

Positioning a secondary div beside a primary div that is centered on the page

As I work on my website, I have a container that encompasses the entire design and is perfectly centered using margin:auto. Now, I am looking to float specific content to the right of this central container in a way that it stays attached to the side reg ...

Can the functions passed into Material-UI withStyles() be relocated within the component?

Attempting to break down the components of my dashboard into smaller parts has proven challenging due to their dependence on drawerWidth. Initially, I considered moving drawerWidth into the state so it can be passed down to each component. However, I encou ...

A sleek CSS text link for a stylish video carousel

I am attempting to create a CSS-only text link to video slider within our Umbraco CMS. Due to the limitations of TinyMCE WYSIWYG, I am restricted in the amount of code I can use as it will strip out most of it. So far, I have developed a basic CSS slider ...

I need to see the image named tree.png

Could someone assist me in identifying the issue with this code that only displays the same image, tree.png, three times? var bankImages = ["troyano", "backup", "tree"]; jQuery.each( bankImages, function( i, val ) { $('#imagesCon ...

Switch the scroll direction in the middle of the page and then switch it back

Yesterday, while browsing online, I stumbled upon this website and was amazed by the unique scroll direction change from vertical to horizontal mid-page. I'm curious about how they managed to achieve that effect. Does anyone have insight into the pro ...

Attempting to include a JSON data as a multi-line text under a key in a JSON data list, and then store the list in a neatly formatted JSON file

I am working with a list of JSON data named mylist that contains information about a site. My goal is to add the site's network logs as a value in the list using a key-value pair. Given that the network logs are extensive, I want to store them as mult ...

Having trouble identifying the CSS style being applied to a specific element

In this image, a red border is seen on the input fields indicating an error with some CSS style being applied. Despite this, it is difficult to determine which CSS selector is causing this as Firebug does not reveal any applied styles. https://i.stack.img ...

Unable to get the div to properly follow when scrolling, even when using the fixed position attribute

My webpage is divided into two sections - left and right. I've used divs to create the left navigation and right content. However, when scrolling down the page, only the right portion scrolls while the left navigation remains fixed. I'm looking ...

Is there a way for me to set distinct values for the input box using my color picker?

I have two different input boxes with unique ids and two different color picker palettes. My goal is to allow the user to select a color from each palette and have that color display in the corresponding input box. Currently, this functionality is partiall ...

Why do CSS media queries stop working at exactly 5 distinct resolution sizes? This seems odd

Just completed my first JavaScript project, a 3D website using three.js. However, right before publishing, I realized that the dimensions and contents were not optimized for viewing on browsers other than 1920x1080. So, I delved into setting DevicePixelRat ...

Conceal Choices During Search using jQuery Select2

I'm having trouble figuring out how to make the Select2 plugin work for my specific color selection feature. My goal is to allow users to choose 5 colors from a list, including an "Other" option. When the user selects "Other", they should be able to ...

The appearance of the website varies across different web browsers

My current project involves creating a portfolio showcasing my work, but I've encountered an issue: When you visit my website and click on the "About" link, the text at the bottom of the tab is displayed differently in Chrome compared to IE and Firef ...

Tips for transforming a menu into a dropdown menu

Is there a way to convert the current menu into a Dropdown menu? Currently, the menu is not collapsing and it keeps opening. Any suggestions on how to achieve this? Here is an example for reference: https://i.stack.imgur.com/2X8jT.png ar ...

Ensuring Bootstrap 3 Table Header Widths Remain Fixed

How can I ensure the header columns in my Bootstrap 3 table maintain a fixed width, regardless of the content in the regular rows? I want to avoid the messy look of content splitting onto multiple lines. Here's an example: I'd prefer not to adju ...

What is the best way to make a flex box smoothly appear on the

Is there a way to make a flex box hidden until it fades in without losing its flexibility? I used to use 'display: 0;' and then apply jQuery .fadeIn(). However, setting display to 0 causes the flex properties of the box to disappear when fading i ...

Using jQuery to insert a new string into the .css file

I'm currently working on a jQuery function to make my font size responsive to changes in width. While I am aware of other options like Media Query, I prefer a solution that offers smoother transitions. Using vw or vh units is not the approach I want t ...

Avoiding scrolling when a button (enveloped in <Link> from react-scroll) is pressed in React

Currently, I am implementing the smooth scroll effect on a component using react-scroll. However, adding a button inside the component to create a favorite list has caused an issue where the smooth scroll effect is triggered upon clicking the button. Is ...

Apply an opacity setting of 0.5 to the specific segment representing 30% of the scrollable div

I have a scrollable container for displaying messages. I would like to apply an opacity of 0.5 to the content in the top 30% of the container, as shown in this image: https://i.stack.imgur.com/NHlBN.png. However, when I tried using a background div with a ...

In JavaScript, alert a message once all images have been clicked

I'm encountering a small issue with my javascript code. I am developing a game for a school project where the objective is to click (remove) fish using a fishing rod. However, the game does not have an end condition set up, so players cannot win. Belo ...