How do I remove the top margin in a web page?
Posted
by RoryG
on Stack Overflow
See other posts from Stack Overflow
or by RoryG
Published on 2010-03-21T22:45:55Z
Indexed on
2010/03/21
22:51 UTC
Read the original article
Hit count: 304
html
I have had this problem with every web page I have created. There is always a top margin above the 'main container' div I use to place my content in the center of the page. I am using a css style sheet and have set margins and padding in the body to 0px and set the margin and padding to 0 in the div:
body{
margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;
padding: 0;
color: black; font-size: 10pt; font-family: "Trebuchet MS", sans-serif;
background-color: #E2E2E2;}
div.mainContainer{
height: auto; width: 68em;
background-color: #FFFFFF;
margin: 0 auto; padding: 0;}
I have looked online many times, but all I can see to do is set these margin and padding attributes. Is there something else I should be doing? The margin exists in IE and Firefox.
© Stack Overflow or respective owner