Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8886105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:28:38+00:00 2026-06-14T21:28:38+00:00

I have the following code for my nav bar and can’t seem to center

  • 0

I have the following code for my nav bar and can’t seem to center it on the website. What am I doing wrong? Removing float: left does nothing for positioning.
Thanks.

css

ul#list-nav {
    list-style: none;
    margin: 20px auto;
    padding: 0px;
    width: 800px;
}

ul#list-nav li {
    display: inline;
}

ul#list-nav li a {
    text-decoration: none;
    padding: 5px 0;
    width: 100px;
    float: left;
    background: #485e49;
    color: #eee;
    text-align: center;
    border-left: 1px solid #fff;
}

ul#list-nav li a:hover {
    background: #a2b3a1;
    color: #000
}

html

</head>
<body>
    <div id="as">
        <ul id="list-nav">
            <li><a href="#">Home</a></li>
            <li><a href="#">About Us</a></li>
        </ul>
    </div>
</body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:28:39+00:00Added an answer on June 14, 2026 at 9:28 pm

    It is already centered, it’s just that you are using explicit width for your menu so consider decreasing your menu width

    Demo

    CSS

    ul#list-nav {
      list-style:none;
      margin:20px auto;
      padding:0px;
      width:800px;
      border: 1px solid #ff0000;
      overflow: hidden;
    }
    

    Currently I’ve made it 205px

    CSS

    ul#list-nav {
      list-style:none;
      margin:20px auto;
      padding:0px;
      width:205px;
      border: 1px solid #ff0000;
      overflow: hidden;
    }
    

    Fixed demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code to display all pages into a nav bar in
I have the following CSS code, and my problem is that my nav bar
I have a nav bar being applied to my site with the following code:
I have the following code $(#nav-mail).mouseenter(function(){ $(#dropdown_mail).show(); }); $(#dropdown_mail,#nav-mail).mouseleave(function(){ $(#dropdown_mail).hide(); }); and I am
I have write following code to make a navigation bar following demo . <ul
I have the following code in viewDidLoad (to set a title in the nav
I have the following code: $('#main-nav a').mouseover(function() { var name = $(this).attr(rel); $(#subnav ul.
I have changed my navigation bar color via the following code navconFvc.navigationBar.tintColor = [UIColor
Without going into details, I have the following jQuery code: $(nav ul ul).each(function ()
I have a following code $(document).ready(function(){ //When mouse rolls over $(#nav #nav_li).mouseover(function(){ $(this).stop().animate({height:'140px', width:'182px'},{queue:false,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.