unable to cancel out the default padding

Discussion in 'HTML & Website Design' started by creative_007, Jan 30, 2007.

  1. #1
    Hi,
    As i said, i am unable to cancel out the padding that comes after the <body> tag. For example consider the below code:

    <html>
    <head>
    <title>asd</title>
    <style>
    #header{height:100px; width:780px; background-color:red;}
    </style>
    </head>
    <div id="header"></div>
    <body>
    </body></html>

    After saving this as html file, one can see that the header section has got an automatic padding from all sides. Can anyone tell me how do i cancel this out?
    I want the design to be continuous, not as if it has been pasted on some other background
    Regards
     
    creative_007, Jan 30, 2007 IP
  2. unitedrokz

    unitedrokz Peon

    Messages:
    86
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    add this to the top of your css file (or style in html)

    * {
    margin:0px;
    padding:0px;
    }
     
    unitedrokz, Jan 30, 2007 IP
  3. creative_007

    creative_007 Active Member

    Messages:
    318
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #3
    thank you...got it right now
     
    creative_007, Jan 30, 2007 IP
  4. Ginger Ninja

    Ginger Ninja Guest

    Messages:
    161
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That is the first 4 lines of every stylesheet I create.

    creative_007, I cancels out the default margin and padding of every element of your design.

    If you just wanted to cancel out the margin of your body then the below code would have done that;

    body {
    margin:0px;
    }
     
    Ginger Ninja, Jan 30, 2007 IP
  5. unitedrokz

    unitedrokz Peon

    Messages:
    86
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    it doesnt exactly cancel it out though.... its just sets every margin and padding that isnt specifically set to 0

    so if further down you specifically state a certain div to have a padding:4px; for example - then it will get that padding
     
    unitedrokz, Jan 30, 2007 IP
  6. Ginger Ninja

    Ginger Ninja Guest

    Messages:
    161
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Which is what I meant. Sorry for not been clearer.:rolleyes:
     
    Ginger Ninja, Feb 1, 2007 IP