height in css vh code example
Example 1: css height property
height: 300px;
height: 25em;
height: 75%;
height: max-content;
height: min-content;
height: fit-content(20em);
height: auto;
height: inherit;
height: initial;
height: unset;
Example 2: what is css vh
CSS VH unit Property
Viewport Height ( vh )
– A percentage of the full viewport height. 10vh will resolve to 10% of the current viewport height. Viewport Minimum ( vmin )
– A percentage of the viewport width or height, whichever is smaller.
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>