Html: White Space Around Elements, How To Remove?
My webpage contains several divs. Some are set to width: 100%, so they fill the whole page width. But at the top of the page there is a small whitespace before the first element sh
Solution 1:
You must remove the margin on body
:
body {
padding:0;
margin:0;
}
You can also remove padding and margin on html
and body
html, body {
padding:0;
margin:0;
}
But I would not advise to use *
(the universal selector)
* {
margin: 0px;
padding: 0px;
}
This would remove padding and margins on all elements.
Solution 2:
The good method is to always use at the begining of the file (I forgot to metion this):
*{
margin: 0px;
padding: 0px;
}
This two line's at the begining of main CSS file fix many problem's that you can encounter. Hope it'll help you.
Post a Comment for "Html: White Space Around Elements, How To Remove?"