The 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:

html<h1>Text1</h1>
<p>text2</p>
cssbody{
  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