css viewport height and width code example
Example 1: 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;
}
Example 2: what are the viewport based units in html
The viewport based units are:
vh , vw , vmin, vmax .
Example 3: what if i want a section to take the height of a viewport html
<section></section>
<section></section>
<section></section>
<section></section>
<section></section>