stretching a div tag across the entire screen

Discussion in 'HTML & Website Design' started by bonecone, Nov 25, 2009.

  1. #1
    I'm trying to replicated the same type of div header that you see on reddit, the light gray one across the top with no margin space around it. I've tried replicating the css attributes, even the ones that don't seem relevant, but my header still has space on both sides and above it where the body background color shows through.

    I've set the width to 100% and the margin to 0 without any luck.

    The only thing that sort of worked was using absolute positioning and then setting the left and top attributes to 0px. This worked, but then the content underneath it would move up to the top of the screen and overlap with it.
     
    bonecone, Nov 25, 2009 IP
  2. live-cms_com

    live-cms_com Notable Member

    Messages:
    3,128
    Likes Received:
    112
    Best Answers:
    0
    Trophy Points:
    205
    Digital Goods:
    1
    #2
    body { margin: 0; }
     
    live-cms_com, Nov 25, 2009 IP
  3. bonecone

    bonecone Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks. Worked.
     
    bonecone, Nov 25, 2009 IP
  4. valu

    valu Peon

    Messages:
    222
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yup. I had the same problem until I resolved it with body margin 0 :)
     
    valu, Nov 25, 2009 IP