liveBook · Manning

Unitless number

As explained in Math for Web Design

A unitless value is a CSS numeric value without a length or other measurement unit whose interpretation depends on the property.

A unitless number has no length or measurement unit; CSS interprets it according to the property. Its most useful typography role is preserving a proportional line-height relationship through inheritance. section 3.4.6

Why unitless line-height survives inheritance

With a parent font size of 20px and line-height: 150%, the child inherits a computed 30px line height. With line-height: 1.5, the child keeps the multiplier and computes 24px from its own 16px font size. The number 1.5 therefore scales with each descendant’s font size. section 3.4.6

Unitless values can also support responsive typography calculations. CSS custom properties store base font and line-height numbers, then calc() derives a unitless line-height and a pixel max-width for a chosen font size. section 8.1.2

Scaling type with a unitless factor

Starting from a 16px base font, a 1.45 base line-height, and a 24px article font size, the calculation produces line-height: 1.37 and max-width: 720px. Other font sizes produce corresponding values such as 1.49 at 12px and 1.29 at 32px. section 8.1.2

Outside CSS properties, a unitless value can represent an angle in radians. JavaScript trigonometric functions require radians, so degrees must be multiplied by Math.PI / 180 before calling Math.sin(), Math.cos(), or related functions. section 9.1.3

How Math for Web Design covers it

How deep it goes
Explains inheritance calculations, responsive formulas, and degree-radian conversion, stopping short of broader CSS numeric-value rules.
Examples
Uses inherited line-height examples, CSS typography calculations, a scaling results table, and JavaScript degree-radian formulas.
What it assumes
Assumes basic CSS inheritance, font sizes, CSS calculations, and JavaScript Math functions while explaining the needed arithmetic.
What you can do after
Apply unitless line-height for proportional inheritance and convert degree values to JavaScript-compatible radians.
How it connects
Connects unitless numbers to CSS inheritance, computed values, line-height, CSS custom properties, responsive typography, JavaScript, and radians.

Also explained in

Compare how 2 books explain unitless number →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math for Web Design. The section links point to the parts of the book it draws on.