JS get viewport width
//getting the viewport dimensions
var width= Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
var height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
JS get viewport width
//getting the viewport dimensions
var width= Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
var height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
what if i want a section to take the height of a viewport html
/* in css file */
html,
body {
height: 100%;
margin: 0;
}
section {
height: 100vh;
}
section:nth-child(1) {
background: lightblue;
}
section:nth-child(2) {
background: lightgreen;
}
section:nth-child(3) {
background: purple;
}
section:nth-child(4) {
background: red;
}
section:nth-child(5) {
background: yellow;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us