CSS 2026-11-05
CSS, short for Cascading Style Sheets, describes the presentation of structured documents such as HTML pages. A CSS selector identifies elements to which a rule applies; a CSS declaration assigns a property and value. The CSS cascade resolves competing declarations, while some properties can inherit values from an element's parent.[ref]
Assigning property values, Cascading, and Inheritance in CSS 2.2 by W3C. Chapter 6, opening property-assignment description; §§6.2 and 6.4, inheritance and cascade
For example, consider the rules
p { color: blue; } and .warning { color: red; }. A paragraph with class="warning" matches both CSS selectors. For these ordinary rules in the same styling context, the class selector has greater CSS specificity than the element selector, so the paragraph is red even if the blue rule is written later. A CSS cascade therefore does more than choose whichever declaration was encountered last.[ref]Assigning property values, Cascading, and Inheritance in CSS 2.2 by W3C. §6.4.1, cascading order; §6.4.3, selector-specificity calculation
If a child element supplies no overriding color, it can inherit the paragraph's red color. That does not mean every property is inherited: properties define their own inheritance behavior. A width declaration such as
width: 200px also concerns layout in CSS pixels; it does not promise a width of 200 physical display pixels.[ref]CSS Values and Units Module Level 3 by World Wide Web Consortium. §5.2, absolute lengths and distinction between reference and device pixels
Keeping document structure in HTML and presentation in CSS allows the same content to receive different screen or print styling. The rules describe the desired presentation; the browser determines the layout and rendered image from the document, styles and output device.
CSS pixel 2026-11-05
A CSS pixel, written
px, is a unit of length in CSS layout. Its reference definition concerns a visual angle, while the specification fixes the ratios between CSS absolute length units:within the CSS unit system. The browser can anchor these units to physical measurements or to a reference pixel appropriate to the output medium. Consequently, a CSS pixel does not necessarily equal one physical display pixel.[ref]CSS Values and Units Module Level 3 by World Wide Web Consortium. §5.2, Absolute Lengths, unit table, anchoring rules and reference-pixel definition
For example, a box with
width: 100px has a declared width of 100 CSS pixels. On a display mapping two device pixels to each CSS pixel along each axis, that width spans 200 device pixels before any additional transforms. A square of side 100 CSS pixels spans a device-pixel region in that simple mapping. The device pixel ratio connects these two coordinate scales.The fixed ratio
96px = 1in does not measure a monitor's physical pixel density. A browser's on-screen 1in can differ from a measured physical inch when the reference-pixel anchor is used. Page zoom can also change the physical size of the layout's CSS pixels, even though the declared number 100px remains the same.[ref] Pixel density 2026-11-05
Pixel density measures how many pixels occupy a specified physical length or area. For a flat display with square, uniformly spaced pixels, its linear pixel density is often expressed as pixels per inch. Its reciprocal is the pixel pitch, the physical separation between corresponding points of neighbouring pixels.
If the display has horizontal and vertical counts and diagonal measured in inches, the Pythagorean theorem gives the linear pixel densityA hypothetical display with a diagonal has pixels per inch. Its pixel pitch is . At the same pixel counts, halving the diagonal doubles the linear pixel density and quadruples the number of pixels per unit area. These calculations assume the quoted diagonal is the active image area.
A stored image's pixel counts do not determine its physical size without a display or printing scale. Likewise, a CSS
px is a layout unit rather than a promise of one physical display pixel. CSS fixes 96px = 1in within its unit system, but the mapping onto physical display pixels depends on the chosen anchor and device. That ratio cannot be used to infer a screen's measured pixel density.[ref] Point (typography) 2026-11-05
A typographic point is a unit used for font size, line height and other typographic distances. In the modern digital convention,Here the inch is 25.4 millimetres. The equation describes the digital convention; historical typographic point systems have not all used that same length. The modern
pt relation also appears among the absolute-length units defined for CSS.[ref]CSS Values and Units Module Level 3 by World Wide Web Consortium. Section5.2: absolute lengths and the pt, in and px equivalences
For example, a font size of 12 typographic points corresponds to a nominal em of one sixth of an inch, approximately 4.2333 millimetres. That sets the outline's scale, rather than the exact ink height of every glyph. A particular x-height or glyph advance can be a different fraction of an em.
The CSS conversion also gives 12 typographic points as 16 CSS pixels. A CSS pixel is a layout unit, so this equality does not promise 16 hardware pixels or a ruler-measured physical height on every screen. Zoom and the mapping to device pixels must be accounted for separately; the device pixel ratio records one part of that mapping.