css relative font size code example

Example 1: vh and vw

/*vh viewport height and vw viewport width*/
/*example*/
div
{
  display: inline-block;
  height: 100vh; /*THis will set height equal to the height of windows*/
  width: 100vw/*This will set width equal to width of windows*/
}

Example 2: em css

/*realative to the font-size*/

Example 3: em is relative to its font size

<div id='contain' style='height: 400px'>
  <div style='height: 1.5em'>Test 1</div>

  <div style='height: 50%'>Test 2</div>
</div>

Tags:

Css Example