CSS Navigation Bar Stick To Top?

Discussion in 'CSS' started by gary15, Dec 2, 2008.

  1. #1
    How do i get a navigation bar to stick to the top of the page without starting a few pixels below the top of the page?

    here's my css code

     
    gary15, Dec 2, 2008 IP
  2. whirlybird20

    whirlybird20 Guest

    Messages:
    462
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I believe the default is usually a few pixels, so try setting body's top margin to 0px.

    body{
    margin-top:0px;
    }
     
    whirlybird20, Dec 3, 2008 IP
  3. gary15

    gary15 Peon

    Messages:
    145
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks mate it worked, to center the layout and everything we use the margin:0 auto;

    right?
     
    gary15, Dec 3, 2008 IP
  4. cheapez

    cheapez Active Member

    Messages:
    1,123
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #4
    yes, that is to center it in firefox.
    Check if it works in IE, IE sometimes need this to make it works text-align: center;
     
    cheapez, Dec 3, 2008 IP