Answers for "body margin 0"

CSS
8

margin 0 auto

Specifying 0 tells the browser to set the top and bottom margin to 0.

Specifying auto tells the browser to automatically determine the left
and right margins equally.

It's the same as:

margin-top:0;
margin-bottom:0;
margin-left:auto;
margin-right:auto;
Posted by: Guest on March-31-2020
0

css my body have margin top

You probably have an element with margin-top as one of the first children of body.

Read up on collapsing margins.

Purely as a simple test, set padding: 1px on body. If the gap goes away, I'm right.

/* 
from stackoverflow.com ->
css & html5: why does my body have a spacing at the top

 */
Posted by: Guest on March-06-2021

Browse Popular Code Answers by Language