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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Center align nav buttons in css

  • 22-10-2012 3:24pm
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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, Registered Users 2 Posts: 128 ✭✭alanc


    Thanks mccarthyi,

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

    AL.


Advertisement