offline version v3


176 of 298 menu

rem unit

The rem relative unit of measurement sets a font size of the element depending on the font of the root element - <html>. For example, a font equal to 2rem means that it is twice the size of the root element.

Example

Let's set the heading text font one and a half times larger than the root element font, and 1rem to the paragraph:

<h1>Text1</h1> <p>text2</p> body{ font-size: 14px; } h1 { font-size: 1.5rem; } p { font-size: 1em; }

:

See also

  • the px unit
    that specifies a size in pixels
  • the fr unit
    that specifies a size in fr
  • the em unit
    that specifies a size in em
  • the % unit
    that specifies a size in percentage
  • the vw unit
    that specifies a size in vw
  • the vh unit
    that specifies a size in vh
  • the vmax unit
    that specifies a size in vmax
  • the vmin unit
    that specifies a size in vmin
enru