Why does the 'header' never touch the top, left and right?

Discussion in 'CSS' started by nmx, Jul 29, 2007.

  1. #1
    Hi all.

    I've started to learn HTML/CSS again (had basics down before), and at the moment dabbling with CSS freestyle.

    One problem i'm having (and had before), is if I create a banner out of CSS (for example using a div, filling it with a background color), the 'banner' i'm creating never touches the top, left or right of the screen. Why?

    I've tried margin=0;but this still doesn't fix it!

    Here's a screenshot I took of it:
    http://s83.photobucket.com/albums/j307/nmxdesigns/?action=view&current=problem1.gif

    As you can see none of the content boxes touch the edges, which is really annoying. I also tried width=100%, but that didn't work properly and came out messed up.

    Please help me fix this!

    Thankyou,

    -nmx
     
    nmx, Jul 29, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    body { margin: 0; padding: 0; }
     
    krt, Jul 29, 2007 IP
    nmx likes this.
  3. .rianna

    .rianna Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Or you could change you header in your stylesheet to an div ID so it'll be easier to change.
     
    .rianna, Jul 29, 2007 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You need to set the margins and padding to zero for this to work.
     
    Dan Schulz, Jul 29, 2007 IP
  5. nmx

    nmx Active Member

    Messages:
    557
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #5
    Ah thankyou very much! Silly me didn't try that. :eek:

    -nMx
     
    nmx, Jul 30, 2007 IP