What is a CSS unit?

A CSS unit determines the size of a property you’re setting for an element or its content. For example, if you wanted to set the property margin of a paragraph, you would give it a specific value. This value includes the CSS unit.

  • Absolute Units: Units that are “absolute” are the same size regardless of the parent element or window size.
  • Relative Units: Relative units are useful for styling responsive sites because they scale relative to the parent or window size (depending on the unit).