rem unit css $selector code example

Example 1: what is em in css

'em' units for the font-size property will be relative to the'font-size of the parent element'.
'em' units on other properties other than font-size will be relative to the
font-size of the current element. 'rem' units sizes will always be relative 
to the font-size of the root html element.

Example 2: pixels and em mdn

html { 
  font-size: 62.5%; /* font-size 1em = 10px on default browser settings */ 
} 
span { 
  font-size: 1.6em; 
}

Tags:

Html Example