Trying to make full screen frames using 100vw
and 100vh
on divs. I have 2 in this JSfiddle and as you can see there's extra space both on the bottom and on the right of each frame.
Is there a way of using vw
and vh
and having it fit perfectly without the extra space?
The css looks like this:
.f1 {
width: 100vw;
height: 100vh;
background-color: blue;
}
.f2 {
width: 100vw;
height: 100vh;
background-color: grey;
}
*Edit: It seems that making the width: 100%
solves this, but is this solution appropriate? Does it break anything?
as you can see ...
I don't see it in Chrome. – Diversity* { margin: 0; padding: 0; }
– Samsara50vh
high, instead of a100vh
, the problem disappears – because the scrollbar disappears as well. dev.w3.org/csswg/css-values/#viewport-relative-lengths says, “However, when the value of ‘overflow’ on the root element is ‘auto’, any scroll bars are assumed not to exist. Note that the initial containing block’s size is affected by the presence of scrollbars on the viewport.” – but I don’t know how to unify those two statements, as they seem to contradict each other to me … – Bernicebernie