Sunday, 15 January 2012

html - A weird spacing appears when I use margin property -



html - A weird spacing appears when I use margin property -

my html :

<!doctype html> <html> <head> <meta charset="utf-8"> <title>lol</title> </head> <body> <div id="one"></div> </body> </html>

css :

div { background: yellow; width: 77px; height: 77px; border: 1px dotted reddish } #one { margin: 0px 21px 41px 41px }

my margin-top value 0px, nevertheless, spacing beetwen square , top of page appears.

why? here illustration :

and jsfiddle : http://jsfiddle.net/9vqz9/1/

add this:-

html,body{ margin:0; padding:0;}

html css margin

No comments:

Post a Comment