CSS Length + Size Units

  • The difference between absolute and relative CSS length units.
  • Absolute units are fixed in their size, meaning that it doesn’t matter if the screen’s width or height changes, the value will remain.
  • Relative units are not fixed, their values are relative to another value which means that when that other value changes, the relative unit value will also change.
  • px and pt
  • px or pixels is an absolute unit which is used to provide a fixed size and define the size of text on the screen. They do not scale with resolution or zoom level.
  • pt or points is an absolute unit which is used to define the size of text for print or physical output as they are most commonly used in print design.
  • em and rem
  • em is a relative unit which is in charge of the font size of the parent element. The “em” unit values are always relative to the value of something else.
  • rem is a relative unit which is in charge of the font size of an html element. The “rem” unit values are always relative to the value of something else.
  • %
  • % or percentage is a relative unit which is used to specify different sizes that’s relative to the size of the parent element.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top