You didn't specify a width to the body
element and since you made it positioned and there is no content inside its width will by default be 0
.
As a side note, you see the grey color cover the whole screen due to background propagation and not because the body
is already full width, so this may create confusion.
Here is the initial code with background color of html
changed so you can clearly see that the body has 0
width:
* {
margin: 0px;
padding: 0px;
border: 0px;
}
html {
background:pink;
}
body {
background-color: grey;
height: 100%;
position: absolute;
margin: 0px;
padding: 0px;
}
.register {
display: table;
width: 100%;
min-height: 25%;
background: red;
}
.FAQ {
display: table;
width: 100%;
height: 25%;
background: blue;
}
.sponsors {
display: table;
width: 100%;
height: 25%;
background: green;
}
.footer {
display: table;
width: 100%;
height: 25%;
background:yellow;
}
<div class="register"></div>
<div class="FAQ"></div>
<div class="sponsors"></div>
<div class="footer"></div>
And if you add width:100%
to the body it will get fixed:
* {
margin: 0px;
padding: 0px;
border: 0px;
}
body {
background-color: grey;
width: 100%;
height: 100%;
position: absolute;
margin: 0px;
padding: 0px;
}
.register {
display: table;
width: 100%;
min-height: 25%;
background: red;
}
.FAQ {
display: table;
width: 100%;
height: 25%;
background: blue;
}
.sponsors {
display: table;
width: 100%;
height: 25%;
background: green;
}
.footer {
display: table;
width: 100%;
height: 25%;
background:yellow;
}
<div class="register"></div>
<div class="FAQ"></div>
<div class="sponsors"></div>
<div class="footer"></div>