what is em and rem in css code example

Example 1: rem vs em

em -> is relative to the font-size of its direct or nearest parent 
rem -> is relative to the html (root) font-size

Example 2: 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 3: css em

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

Example 4: em vs rem

1EM or 1REM (r = root em)
The difference is inheritance.
The Rem value is based on the root element (html).
What is meant here is the font size for html and not the font size for the documet body.
... Em is based on the font size of each
Parent element.

Example 5: em css

/*realative to the font-size*/

Tags:

Misc Example