Results 1 to 10 of 10

Thread: Centering the navigation bar

  1. #1
    Registered
    Join Date
    Oct 2005
    Posts
    21

    Centering the navigation bar

    From advice on the forum I've constructed a navigation bar that changes the colours of the buttons on mouseover. Now I'd like to "center" the bar to ensure it always remains mid-screen regardless of the screen resolution.

    See http://www.simplyclicks.com/Testing.html

    Any help would be welcome.

  2. #2
    Working. Masetek's Avatar
    Join Date
    Aug 2005
    Location
    Aust
    Posts
    543
    Quote Originally Posted by dburdon
    From advice on the forum I've constructed a navigation bar that changes the colours of the buttons on mouseover. Now I'd like to "center" the bar to ensure it always remains mid-screen regardless of the screen resolution.

    See http://www.simplyclicks.com/Testing.html

    Any help would be welcome.

    Easy

    Wrap the list in <div style="text-align: center;"></div>

    Or extend the div that your header image is in to wrap around it.
    Last edited by dpmmedia; 01-12-2006 at 05:45 AM.

  3. #3
    Registered
    Join Date
    Oct 2005
    Posts
    21

    Thanks - I'll give it a try

    DPM Media,

    thanks. I'll give it a try.

  4. #4
    Senior Member agua's Avatar
    Join Date
    Sep 2005
    Location
    Pottsville, NSW
    Posts
    531
    I'd try this:
    Code:
    #nav {
    width: 570px;
    margin-right: auto;
    margin-left: auto;
    }
    and wrap your whole ul tag (and all inbetween) like this
    Code:
    <div id="nav"><ul>....</ul></div>
    I think the text align:center won't work because you have float lefts in your nav css code, so you need to specify a width for the element and center it using margins.

    It would be much easier if text-align:center worked IMO - but hey.
    I Do Website Design - but I am here to learn all about publishing

  5. #5
    I'm the oogie boogie man! James's Avatar
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    1,566
    You need text-align: center; around the containing div of an element which is centred using margin-left: auto; margin-right: auto;. Internet Explorer doesn't centre using margin-left and right.

  6. #6
    Registered
    Join Date
    Oct 2005
    Posts
    21

    Thanks

    Agua, James,

    thanks for the advice.

    Any help you need on anything commercial, let me know.

    Regards,

    David Burdon

  7. #7
    Working. Masetek's Avatar
    Join Date
    Aug 2005
    Location
    Aust
    Posts
    543
    Quote Originally Posted by James
    You need text-align: center; around the containing div of an element which is centred using margin-left: auto; margin-right: auto;. Internet Explorer doesn't centre using margin-left and right.
    Damn annoying that.

  8. #8
    Senior Member agua's Avatar
    Join Date
    Sep 2005
    Location
    Pottsville, NSW
    Posts
    531
    Yeah - internet explorer is annoying regards css - has anyone tried the new version, 7 I think?
    I Do Website Design - but I am here to learn all about publishing

  9. #9
    Working. Masetek's Avatar
    Join Date
    Aug 2005
    Location
    Aust
    Posts
    543
    Quote Originally Posted by agua
    Yeah - internet explorer is annoying regards css - has anyone tried the new version, 7 I think?
    It's not out yet. But *apparenty* all the current css bugs will be fixed. That's not to say your problems will be over once its out, it will take ppl ages to upgrade..

    Edit: Sorry, my bad. I was reading an outdated blog. Its out for dev testing.

    BTW, this is the first page Ive seen with PR10
    http://www.microsoft.com/windows/ie/default.mspx
    Last edited by dpmmedia; 01-12-2006 at 07:15 PM.

  10. #10
    I'm the oogie boogie man! James's Avatar
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    1,566
    Knowing MS, they'll just make the most annoying bugs worse, and introduce new ones that weren't there before.

    And same @ PR10.

Similar Threads

  1. Fading Music In And Out During Navigation
    By greenpixel in forum HTML, CSS, Layout, and Design
    Replies: 1
    Last Post: 10-14-2004, 09:55 AM
  2. Left side navigation, need extra row above that?
    By sitepointRefugee in forum Search Engine Optimization
    Replies: 3
    Last Post: 03-26-2004, 07:32 AM
  3. Naming links in menus (navigation)
    By KeithMcL in forum HTML, CSS, Layout, and Design
    Replies: 8
    Last Post: 11-16-2003, 10:53 AM
  4. Site navigation...
    By Stevens in forum HTML, CSS, Layout, and Design
    Replies: 6
    Last Post: 10-27-2003, 01:24 PM
  5. Navigation and internal linking structure...
    By tragu in forum Search Engine Optimization
    Replies: 3
    Last Post: 09-22-2003, 12:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •