HTML CSS JavaScript SEO Python Posts Privacy About Contact

CSS Units

Master the mathematical distances defining sizing and typography scaling.

To designate padding expanses, structural lengths, or typographic weights, CSS utilizes an array of distinct measurement designations. Understanding the discrepancy between absolute lengths and scalable measurements is critical.

Absolute vs Relative

Measurements branch into two severe categories:

  • Absolute Lengths: Hard-coded distances. A pixel length (px) will rigidly render EXACTLY that magnitude, entirely uncaring toward user screen sizes.
  • Relative Lengths: Reactive distances. Sizes shift dynamically referencing other dominant components globally.
Preview

The REM Typography Revolution

Using simple px for font scaling crushes accessibility for partially sighted users attempting to scale text. Alternatively, deploying the rem constraint designates sizing directly dependent upon the raw HTML root size (defaulting historically to 16px).

p {
  font-size: 1.5rem; /* Calculates accurately to ~24px */
}

If an individual manipulates their custom browser font metric bigger, your entire website interface will gracefully inflate proportionately avoiding broken overlapping grids.