Update : The following behavior does not appear in Firefox.
Let's start with the following situation:
html {
background: red;
}
body {
margin: 0;
min-height: 100vh;
background-color: green;
}
div {
min-height: 50px;
background-color: pink;
margin-bottom: 50px;
}
<div></div>
Run codeHide resultThe body is defined with min-height:100vh
and we have a scroll bar that allows us to see html
. Here we have a narrowing of the fields , the field div
is compressed with the field of the body and, thus, we create this space after the body and scroll bar.
If we refer to the specification, we have this case:
Two fields are in contact if and only if:
...
the bottom field of the last incoming child and the bottom field of its parent if the parent has a calculated height of 'auto'
div
- , body
auto, min-height.
, , . - , div
.
:
html {
background: red;
}
body {
margin: 0;
min-height: 100vh;
background-color: green;
}
div {
min-height: 50px;
background-color: pink;
margin-bottom: 50px;
}
.l {
width:45%;
height:50px;
float:left;
margin:0;
}
.r {
width:45%;
height:50px;
float:right;
margin:0;
}
<div></div>
<div class="l"></div>
<div class="r"></div>
Hide result, (- ), .
, : ?
, . , :
- - ( , )
- , , , / . ( )
:
, , , , ; .
, , , , , . ( , , )
, . , ?
? , , - , - , ?
: , , , . 5 (, , , flexbox ..). , .
: , @Alohci ,