css vw code example
Example 1: vw css
Viewport Width (vw). This unit is based on the width of the viewport.
A value of 1vw is equal to 1% of the viewport width.
Example 2: vh and vw
div
{
display: inline-block;
height: 100vh;
width: 100vw
}
Example 3: vh in css
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
font-size: 20vh;
}
</style>
</head>
<body>
<h1>Hello</h1>
<p>Resize the height of the browser window to see how the font-size of h1 changes.</p>
<p>1vh = 1% of viewport height.</p>
<p>The vh unit is not supported in IE8 and earlier.</p>
</body>
</html>
Example 4: vw css
Viewport Width (vw). This unit is based on the width of the viewport. A value of 1vw is equal to 1% of the viewport width. Viewport Minimum (vmin). This unit is based on the smaller dimension of the viewport.