Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Center align nav buttons in css

Options
  • 22-10-2012 4:24pm
    #1
    Registered Users Posts: 128 ✭✭


    Sorry if this is a silly question, but I am trying to center align Horizontal nav buttons on a website. And how do I set the same width for every button? I'm worse than totally new to this but have a project to do, so any help would be great thanks.

    Al.

    Attached both the Home page and the css code in text doc's.


Comments

  • Registered Users Posts: 2 mccarthyi


    To centre the links add text-align:center; to the ul#nav li a rule, to set a width for all the links add width:?px (where ? is the width you want) to the same rule;


  • Registered Users Posts: 128 ✭✭alanc


    Thanks for your speedy reply, but I cant seem to get that working. It looks like it is just tabbed in. Sorry I'll say again I am totally new to this.

    AL.


  • Registered Users Posts: 2 mccarthyi


    Attached are two screenshots. Capture1 shows your page with the code you attached. Capture2 show how it looks with the changes I suggested.
    The css should look like this
    ul#nav li a {
       float: left;
       padding: 8px 5px 3px 5px;
       line-height: 2em;
       margin-right: 5px;
       background-color: #034a7f;
       color: #fff;
       font-weight: bold;
       text-decoration: none;  
       [B]text-align:center; 
       width:140px;[/B]}
    


  • Registered Users Posts: 128 ✭✭alanc


    Thanks mccarthyi,

    Not sure what I was doing wrong, works perfectly, cheers.

    AL.


Advertisement