vh dimension css code example

Example 1: css em

em -> Relative to the font-size of the element 
(2em means 2 times the size of the current font)

Example 2: vh in css

/*
vh	Relative to 1% of the height of the viewport*
*/
<!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>

/*
I hope it will help you.
Namaste
Stay Home Stay Safe
*/

Tags:

Css Example