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 8762357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:30:39+00:00 2026-06-13T15:30:39+00:00

My CSS UL menu doesn’t seem to want to centre, any ideas? I have

  • 0

My CSS UL menu doesn’t seem to want to centre, any ideas? I have pasted the code below for your review, I am quite new to CSS so your help is greatly appreciated 🙂

The only way I have been able to centre it is by fixing the width and using the html centre tags but I need the menu to be at 100% for expansion and I need to to automatically centre.

The CSS

#menu{
    width:100%;
    margin: 0;
    padding: 5px 0 0 0;
    list-style: none;
    background-color:#333333;
    text-align:center;
}

#menu li{
    float: left;
    padding: 0 0 5px 0;
    position: relative;
    list-style:none;
    margin:auto;
}

#menu ul{
        list-style:none;
        display:inline;
        margin: 0;
        padding: 0;
        text-align: center;
}

#menu a{
    float: left;
    height: 15px;
    padding: 0 25px;
    color:#FFF;
    text-transform: uppercase;
    font: 10px/25px Arial, Helvetica;
    text-decoration: none;
    text-shadow: 0 0px 0 #000;
}


#menu li:hover > a{
    color:#F90;

    font: bold 10px/25px Arial, Helvetica;
}

*html #menu li a:hover{ /* IE6 */
    color: #F06;
}

#menu li:hover > ul{
    display: block;
}

Thanks again 🙂

  • 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-13T15:30:41+00:00Added an answer on June 13, 2026 at 3:30 pm

    Provide width to your menu and use margin: auto;

    #menu{
        width:300px; <--------Here
        margin: 0 auto; <-----Here
        padding: 5px 0 0 0;
        list-style: none;
        background-color:#333333;
        text-align:center;
    }
    

    Moreover why are you doing this?

    #menu li:hover > ul{
        display: block;
    }
    

    And also this

    #menu a{
        float: left;
        ....
    }
    

    Update: just read all the styles your cascade looks pretty messed up, use the following

    #menu { /* I Assume this ID is applied to <ul> element */
        width:/*Whatever you want to define*/;
        margin: 0 auto; <---Change Here
        padding: 5px 0 0 0;
        list-style-type: none;  <---Change Here
        background-color:#333333;
        text-align:center;
    }
    
    #menu li{
        float: left; <---You don't need this
        padding: 0 0 5px 0;
        position: relative; <---You don't need this too
        list-style:none; <---You don't need this too
        margin:auto; <---You don't need this too
    }
    
    /* Take out this entirely from here */
    #menu ul{
            list-style:none;
            display:inline;
            margin: 0;
            padding: 0;
            text-align: center;
    }
    /* till here */
    
    #menu a{
        float: left; <---You don't need this
        height: 15px;
        padding: 0 25px;
        color:#FFF;
        text-transform: uppercase;
        font: 10px/25px Arial, Helvetica;
        text-decoration: none;
        text-shadow: 0 0px 0 #000;
    }
    
    
    #menu li:hover > a{
        color:#F90;
    
        font: bold 10px/25px Arial, Helvetica;
    }
    
    *html #menu li a:hover{ /* IE6 */
        color: #F06;
    }
    
    #menu li:hover > ul{
        display: block;
    }
    

    And if you want your links inside the menu too be centered simply use this

    HTML

    <ul id="#menu">
      <li></li>
    </ul>
    

    CSS

    #menu li {
      text-align: center;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a drop down menu in CSS, but it doesn't seem to
I have the following code that I want to slim down. $('#1').hover(function() { $('#hiddenMenu1').css('display',
I have this CSS menu: http://jsfiddle.net/7JC8t/ If you hover your mouse over 'inostranstvo' you
I have a drop-down/multi-level CSS menu on a page. The menu however doesn't appear
I have a horizontal CSS menu. The problem is when the user creates more
So I have a fairly simple vertical CSS menu based off of UL. <ul
I have to modify a HTML page because the menu doesn't work with IE6/IE7/IE8.
I have a very simple JavaScript and CSS hover menu setup apart of the
I have the below html that is supposed to create a fly out Menu.
I have a CSS menu. The problem is that in a ul li a

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.