My site it aligned like this:
header
content
footer
(unique I know)
anyways, theres always a space between the site and the top of the screen. How do I get my content to start at the very top of the screen?![]()
| SitePoint Sponsor |
My site it aligned like this:
header
content
footer
(unique I know)
anyways, theres always a space between the site and the top of the screen. How do I get my content to start at the very top of the screen?![]()
Can we see the code or at least a link?
Make sure the header's bottom and content's top margins are set to 0.
Alternatively if that fails, use negative margines, ie:
Good luckCode:margin-top: -1em;![]()
Just to follow on from there, saying nothing and setting a margin to zero are not the same.
If you do not set a setting, browsers will set themselve to the default value, which vary from browser to browser. To get around this, I always set the margins and padding to zero in the body tag.
Then I can add whatever I need from there.
Mikel
Good decisions come from experience.
Experience comes from making bad decisions.
TY it worked!![]()


Note that normally there should be no need for negative margins unless you actually mean to drag something back over something else (or perhaps some obscure browser bug is rearing its ugly headAlternatively if that fails, use negative margines, ie:. (Also note that ie like to have a position:relative on some elements that have negative margins otherwise it doesn't show them at all.)
Most of the times it will be a conflict of margins or just the default margins applied to certain elements that varies from browser to browser as mikel pointed out.
Remember that the largest margin on an element is the one that gets applied. Therefore if you set the top element to have a bottom margin of zero it still won't butt up against the element below unless the element below has had its top margin set to zero also.
Just thought it worth mentioning even though the problem's been sorted
Paul
Bookmarks