1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.
  2. Better Analytics for WordPress Get It Free

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:
    463
    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