• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

Center a dropdown menu line in css

No matter what I try I can't get this display menu line to center.  It also wraps even when I use white-space:nowrap.  How can I resolve these problems:

  • 2
1 Solution
Try this css instead:
#topNavBar {
    background: none repeat scroll 0 0 #0000FF;
    font-weight: bold;
    margin: 0 auto;
    width: 775px;
You can try one of two things:

1.) use the align attribute in your div tag

2.) Place your menu within a table that spans 100% of the page, then center align the menu in a TD tag.
smitty62Author Commented:
I tried text-align, and that didn't work.  I prefer to keep exclusively CSS with no tables.  Is there another align attribute I should try, and if so where in the style sheet should I put it?
Try this css, which will align links to centre of blue line:
#nav {
    line-height: 1.5em;
    list-style-position: outside;
    list-style-type: none;
    margin: 0 auto;
    padding: 0;
    position: relative;
    width: 780px;
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now