unit

rem — CSS reference

rem refers to the root element’s computed font size; when used in the root font-size property itself, it refers to the initial font size.

Formal Syntax & Structure

css syntaxcss
2rem

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>html {font-size:16px} #a {font-size:20px;width:2rem}</style><body><div id="parent"><div id="a">Sample</div><div id="b">Comparison</div></div></body></html>
CSS Reference