CSS box-sizing 2026-11-05
CSS box-sizing is the box-sizing property that selects which box edge applicable length and percentage sizes refer to. With content-box, such sizes describe the CSS content box; with border-box, they include padding and borders in the CSS border box. Margins remain outside both.[ref]
For example, use width: 200px; padding: 16px; border: 2px solid, with no other constraints. Under content-box sizing, the content width is and the CSS border box width is
CSS pixels. Changing only to box-sizing: border-box makes the CSS border box width and the content width
pixels. This is why a width declaration cannot be interpreted independently of its sizing edge.
The content width cannot become negative. If the declared border-box width is only pixels but total horizontal padding and borders require , the content width floors at zero and the actual border box is pixels wide. Border-box sizing does not make arbitrarily thick padding disappear.[ref]
CSS box-sizing changes size interpretation rather than making every property apply to every box. A CSS non-replaced element generating an ordinary inline box still has its width applicability rules. CSS minimum size, CSS maximum size and the surrounding layout also remain relevant to the final CSS used value.
CSS computed value 2026-11-05
A CSS computed value is the result of processing a property's specified value as far as possible without performing the layout-dependent calculations reserved for later stages. Computation resolves details such as inheritance and many relative units; the exact rule belongs to each CSS property.[ref]
For example, if a parent has a computed font size of 20 CSS pixels and its child specifies font-size: 150%, the child's computed size is 30 pixels. A descendant inheriting that font size receives the computed result, rather than the original percentage expression.
Not every relative expression disappears at this stage. A percentage width can remain a percentage until the containing width is known. Similarly, a unitless line-height: 1.5 computes as a number under that property's definition; when inherited by text with a 24-pixel font size, it can yield a 36-pixel used line height. Copying the parent's final pixel height would be a different operation.[ref][ref]
The computed stage therefore supplies a stable representation for inheritance without promising that every value is a final numeric measurement. To turn it into a CSS used value, the formatter can still need containing dimensions, content measurements and the relevant box-layout algorithm.
CSS initial value 2026-11-05
A CSS initial value is the value defined as a property's starting point by its specification. It participates in defaulting when an element has no other specified value under the applicable rules. It is distinct from a browser's default stylesheet declaration and from the value obtained by CSS inheritance.[ref]
For example, the initial value of display is inline, while a browser normally supplies styling that makes a paragraph block-level. Setting p { display: initial; } requests the property's initial value, rather than restoring the browser's usual paragraph appearance. The paragraph's HTML element semantics remain separate from that display choice.
The keyword initial explicitly requests this starting value. inherit requests the parent's computed value instead, and unset chooses inheritance for inherited properties and the initial value for non-inherited properties. Thus these keywords can produce different results even when they appear in the same selector and win the same CSS cascade comparison.[ref]
Initial values also need their normal processing. A width initially set to auto still requires the appropriate sizing algorithm; initial does not mean that every property begins as zero or already has a final pixel size. The sequence from defaulting through computation to the CSS used value explains how a specification-defined starting value becomes a concrete rendering.
CSS maximum size 2026-11-05
A CSS maximum size is an upper constraint supplied by a maximum-size property such as max-width or max-height. It participates in finding the CSS used value, together with the CSS preferred size, CSS minimum size and applicable layout rules.[ref]
For a simple block with zero padding and borders, width: 500px; max-width: 400px; min-width: 240px gives a used width of CSS pixels. With the same constraints but preferred width , the used width is . Once these fixed dimensions are resolved, this simplified calculation is
where is the tentative width, the minimum and the maximum. It expresses the order of limiting the tentative width and then enforcing the minimum in this case.[ref]
If the minimum exceeds the maximum, the minimum wins: min-width: 320px; max-width: 200px does not squeeze the box below its -pixel minimum. Also check CSS box-sizing before interpreting which edge the numbers measure.
A maximum constraint limits the box's size; it does not guarantee that every unbroken descendant fits or specify clipping. Such content may cause CSS overflow. Percentage constraints likewise require the appropriate CSS containing block and a usable dimension reference. These qualifications make max-width: 100% a sizing instruction rather than a universal promise that nothing can extend outside a container.
CSS non-replaced element 2026-11-05
A CSS non-replaced element has content formatted through the normal CSS document layout machinery, rather than supplied as replaced external content. A paragraph containing text and child elements is a typical example. The classification is separate from whether the element participates as inline or block-level content.[ref]
For example, text inside a paragraph can wrap into several CSS line boxes as the available width changes. Its descendant text and elements contribute to layout. Adding a background image does not by itself turn that paragraph into a CSS replaced element; the paragraph's content is still formatted by CSS.
Applicability of sizing properties then depends on the generated box. On an ordinary non-replaced inline span, declaring width: 100px does not make its inline box a fixed-width block. Changing its display to an inline-block or an applicable block box changes the sizing rules, even though the underlying element remains non-replaced.[ref]
This distinction helps explain why two elements with the same width declaration can behave differently. Whether content is replaced, the outer display role and the formatting context must all be specified before treating a declaration as a CSS used value.
CSS preferred size 2026-11-05
A CSS preferred size is a size requested by a preferred-size property such as width or height. The final layout also depends on the applicable sizing algorithm, the CSS containing block and any CSS minimum size or CSS maximum size. Preferred therefore identifies an input to sizing, not an unconditional measurement of the final box.[ref]
For a simple content-box block with no padding or borders, consider width: 300px; max-width: 100% in a 200-CSS pixel containing block. The maximum constraint limits the used width to 200 pixels. With a sufficiently wide containing block, the same preferred width can instead yield 300 pixels. The example assumes no other minimum constraint.
Values such as auto, percentages and content-based sizing keywords have context-dependent meanings. A percentage can depend on whether the relevant containing dimension is definite, and auto sizing can use different rules for ordinary blocks and CSS replaced elements. The word auto is not a universal synonym for one numeric width.
The properties also have applicability limits. A non-replaced inline box is not made into a fixed-size rectangle merely by assigning width and height. Relating a CSS preferred size to a CSS used value requires identifying the box kind and the layout rules that resolve its constraints.
CSS property 2026-11-05
A CSS property is a defined parameter of presentation or layout, such as color, width or margin-left. Its definition specifies allowed values, an initial value, whether it inherits, and how values are computed. A CSS declaration proposes a value for a property on the elements matched by its rule.[ref]
For example, width: 50% names the width property and supplies a percentage value. If that percentage resolves against a containing width of 400 CSS pixels, the resulting width is 200 CSS pixels in the simple case. The same declaration in a 600-pixel containing width can yield 300 pixels. A property name therefore identifies a parameter, while its eventual layout value can depend on context.
Different properties have different value grammars and defaulting behavior. A color word can be valid for color but invalid for width. Foreground color normally inherits, while width does not inherit by default. The absence of a width declaration is therefore different from automatically copying the parent's width.[ref]
A property also differs from an HTML attribute with similar wording. Attribute interpretation is part of the element's document semantics; a CSS property participates in the styling value process, including the CSS cascade. Keeping the property definition, individual declarations and the resulting CSS used value separate makes styling behavior much easier to explain.
CSS property value 2026-11-05
A CSS property value is a value considered or assigned for a CSS property. Its representation changes through value processing: declarations supply candidates, the CSS cascade chooses among applicable candidates, defaulting supplies missing values, and computation and layout resolve further details. The CSS computed value and CSS used value consequently describe different stages.[ref]
Take width: 50%. In a simple block layout, its computed representation can retain a percentage, while the used width depends on the containing width. A 400-CSS pixel containing block gives 200 pixels; changing that block to 600 pixels gives 300. Copying the source string alone would miss why the physical layout changed.
Inheritance can resolve another value before that stage. If a parent's computed font size is 20px and its child specifies font-size: 150%, the child can compute to 30px. That child's descendant inheriting the font size receives the computed result, rather than repeatedly multiplying by the original percentage merely because it is further down the tree.[ref]
Validity is property-specific. A syntactically readable width: blue is not a valid width value, and its failure does not establish a used width of blue or zero. Initial values, CSS inheritance and other applicable declarations determine the result under the relevant rules. Stating the value stage prevents a source token, a computed representation and a measured rendering from being conflated.
CSS used value 2026-11-05
A CSS used value is a value obtained after applying the calculations needed for layout. It can depend on geometry unavailable when the CSS computed value was established, such as the size of a CSS containing block or the sizes of related content.[ref]
For example, an ordinary block whose computed width remains 50 percent can have a used content width of 200 CSS pixels in a 400-pixel containing block. Changing that containing block to 600 pixels yields 300 pixels, with the same computed percentage and with other constraints held fixed. The changed result follows from layout context rather than from a new source declaration.
A used width is also not necessarily the size of the whole outer box. With content-box sizing, padding, borders and margins are accounted for outside the content width. With box-sizing: border-box, the sizing edge is different. CSS minimum size and CSS maximum size constraints can alter the final result as well.[ref]
Even after the used value has been determined, drawing on a particular device can require rounding or other permitted approximation. A fractional CSS length and a count of illuminated physical pixels are consequently different measurements. Stating the property, value stage, sizing edge and coordinate units makes a layout calculation reproducible.