Units

Units that commonly used on websites.

Understanding rem, unitless, em, and px:

rem

Use rem for most parts of your website. Rem units are relative to the root (HTML) element, making them ideal for fluid, scalable, and consistent sizing.

- (unitless)

Ideal for line-height as using em may lead to unexpected results. Unitless values ensure that the line height scales proportionally with the font size.

em

Great for spacing between text and elements. It scales nicely relative to the parent element's text size, providing responsive and proportional spacing.

px

Use px when on borders and small spaces that is fixed and unlikely to change. It helps to display correctly and eliminates the need for calculations.

Visit the Fluid Responsive section to learn more about the purpose of rem.

Last updated