CSS math-depth Property
Description
The math-depth property is intended as a semantic styling hook that reflects the nesting level of subexpressions inside mathematical notation. Rather than being about precise layout calculations, it signals the logical depth of an expression — for example, whether an atom is at the top level, inside a fraction, inside an exponent of an exponent, and so on — so that authors and user agents can apply different visual treatments depending on how deeply the content is nested. This makes it easier to create consistent, readable math styles that adapt to complex structures without manually annotating every subexpression.
In practice the presence of depth information lets typographic systems alter how they render operators, delimiters, and script sizes in a way that preserves readability across nesting. Authors typically use it to influence scaling, spacing or color contrasts for nested components so that small superscripts remain legible and fences (parentheses, brackets) expand or contract appropriately relative to their context. When combined with typographic controls such as font-size, designers can create stepwise size ramps or proportional spacing rules tied to nesting level; when combined with transform effects such as transform, subtle visual emphasis or de-emphasis of deep subexpressions can be applied without altering the underlying semantic structure.
Because math-depth represents a structural attribute rather than a pure presentational value, it works best as part of a broader style strategy: use it to scope rules that improve legibility (for example, increasing inter-element spacing or reducing decoration intensity for very deep nests), to adapt math for small-screen or high-density contexts, or to create consistent visual themes for mathematical content across a site or document. It also helps when authors want to target only parts of a math tree for animation, printing tweaks, or accessibility-focused adjustments, since depth-aware styling can be combined with other cascading rules and media-driven changes to produce predictable, maintainable results.
Definition
- Initial value
- 0
- Applies to
- all elements
- Inherited
- yes
- Computed value
- as specified
- Animatable
- no
- JavaScript syntax
- object.style.mathDepth
Syntax
math-depth: auto-add | add( <integer> ) | <integer>
Values
- auto-addSet to the inherited math-depth plus 1 when inherited math-style is compact.
- add( <integer> )Set to the inherited math-depth plus the specified integer.
- <integer>Set to the specified integer.
Example
Browser Support
The following information will show you the current browser support for the CSS math-depth property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported in some modern browsers, but not all.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
