JSFiddle - React, Tailwind, and code Playground
by phloe
HTML
<div class="vu"></div>
CSS
.vu {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: red;
}
* {
padding: 0;
margin: 0;
}
html, body {
height: 100%;
}
body {
overflow: scroll;
}
JavaScript
var vu = document.querySelector(".vu");
var html = document.documentElement;
console.log("width", html.offsetWidth, vu.offsetWidth);
console.log("height", html.offsetHeight, vu.offsetHeight);