Text

The properties that lay text out within and across lines: alignment and indentation, spacing, white space, wrapping and hyphenation, case and overflow, underlines and emphasis marks, line height and baseline alignment, ruby annotations and MathML layout. Choosing a font is under Fonts; the text colour is under Color & backgrounds; writing-mode, direction and text-orientation are under Writing modes & logical; SVG's text-anchor is under SVG.

Alignment & indentation

text-align

How the lines of a block are aligned within it in the inline direction. start and end follow the text direction, so they flip for right-to-left languages; left and right do not.

Syntaxstart | end | left | right | center | <string> | justify | match-parent | justify-all
Initialstart
Applies toBlock containers
InheritedYes
PercentagesSee individual properties
AnimationDiscrete
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-text-4
ValueEffect
start / endAligned to the start or end edge of the line in the text's direction.
left / rightAligned to the physical left or right edge.
centerCentred.
justifySpaces are stretched so each line fills the width, except the last line, which follows text-align-last.
match-parentLike inherit, but start and end are resolved against the parent's direction.

text-align aligns inline content, not the block itself; to centre a block, use margin-inline: auto.

text-align-last

The alignment of the last line of a block, and of any line just before a forced line break. auto follows text-align, except that justified text ends with a line aligned to the start.

Syntaxauto | start | end | left | right | center | justify | match-parent
Initialauto
Applies toBlock containers
InheritedYes
AnimationDiscrete
SupportChrome 47 · Firefox 49 · Safari 16
Speccss-text-4

text-justify

How justified text is stretched to fill the line. inter-word widens only the spaces between words, which suits languages such as English; inter-character spaces out every character, which suits Chinese and Japanese; none turns justification off.

Syntax[ auto | none | inter-word | inter-character | ruby ] || no-compress
Initialauto
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 145 · Firefox 55 · Safari no
Speccss-text-4

It only has an effect where text-align or text-align-last is justify. auto lets the browser choose a method suited to the language.

text-indent

Indents the first line of a block. A negative value pulls the first line out past the edge, which with matching padding makes a hanging indent.

Syntax[ <length-percentage> ] && hanging? && each-line?
Initial0
Applies toBlock containers
InheritedYes
PercentagesRefer to the block container's own inline-axis inner size
AnimationBy computed value type
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-text-4

hanging inverts the indent so every line except the first is indented. each-line also indents each line that follows a forced line break, not just the first line of the block.

p + p { text-indent: 1.5em; }
Book-style paragraphs: every paragraph after the first is indented.

hanging-punctuation

Lets punctuation hang outside the line box, so the edge of the text lines up with the letters rather than the quotation marks. first hangs an opening mark at the start of the first line, last a closing mark at the end of the last line, and force-end or allow-end a stop or comma at the end of a line.

Syntaxnone | [ first || [ force-end | allow-end ] || last ]
Initialnone
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome no · Firefox no · Safari 26.5
Speccss-text-4

Safari supported it from version 10, but did not hang straight quotation marks until 26.5.

Spacing

letter-spacing

Extra space added between characters; negative values tighten. Use em so the spacing scales with the font size. Non-zero spacing turns off the font's optional ligatures.

Syntaxnormal | <length-percentage>
Initialnormal
Applies toInline boxes and text
InheritedYes
PercentagesRelative to the used font-size
AnimationBy computed value type
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-text-4
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; }
Capitals usually read better with a little extra tracking.

word-spacing

Extra space added to each word separator, on top of the font's own space width. Negative values tighten.

Syntaxnormal | <length-percentage>
Initialnormal
Applies toText
InheritedYes
PercentagesRelative to the used font-size
AnimationBy computed value type
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-text-4

tab-size

The width of a tab character in preserved white space, as a number of space widths or as a length.

Syntax<number [0,∞]> | <length [0,∞]>
Initial8
Applies toText
InheritedYes
AnimationBy computed value type
SupportChrome 21 · Firefox 91 · Safari 7
Speccss-text-4
pre { tab-size: 4; }
Tab-indented code at four spaces per level instead of eight.

text-autospace

Adds a small gap where Chinese or Japanese ideographs meet Latin letters or digits, so mixed-script text does not need hand-typed spaces. no-autospace turns it off.

Syntaxnormal | <autospace> | auto
Initialnormal
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 140 · Firefox 145 · Safari 18.4
Speccss-text-4

<autospace> is no-autospace, or a combination of ideograph-alpha (between ideographs and letters) and ideograph-numeric (between ideographs and digits), with further keywords for punctuation.

text-spacing-trim

Controls the blank space built into full-width Chinese and Japanese punctuation such as brackets and commas. normal trims it in places such as between two adjacent punctuation marks; space-all keeps the full width everywhere.

Syntax<spacing-trim> | auto
Initialnormal
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 123 · Firefox no · Safari no
Speccss-text-4

<spacing-trim> is one of space-all, normal, space-first, trim-start, trim-both or trim-all.

White space & wrapping

white-space

Shorthand for white-space-collapse and text-wrap-mode: whether spaces and line breaks in the source are kept, and whether lines wrap. The single keywords below are the long-standing way to set both.

Syntaxnormal | pre | pre-wrap | pre-line | <'white-space-collapse'> || <'text-wrap-mode'> || <'white-space-trim'>
Initialnormal
Applies toText
InheritedSee individual properties
AnimationDiscrete
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-text-4
ValueSpaces and tabsLine breaksWrapping
normalCollapsedCollapsedYes
nowrapCollapsedCollapsedNo
preKeptKeptNo
pre-wrapKeptKeptYes
pre-lineCollapsedKeptYes
break-spacesKept, and may wrapKeptYes

white-space-collapse

Whether runs of spaces, tabs and line breaks in the source collapse to a single space. preserve keeps them all; preserve-breaks keeps line breaks but collapses spaces; break-spaces keeps them and lets the line wrap after any space, so trailing spaces take up room.

Syntaxcollapse | discard | preserve | preserve-breaks | preserve-spaces | break-spaces
Initialcollapse
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 114 · Firefox 124 · Safari 17.4
Speccss-text-4

text-wrap

Shorthand for text-wrap-mode and text-wrap-style: whether lines wrap, and how the browser chooses where to break them.

Syntax<'text-wrap-mode'> || <'text-wrap-style'>
Initialwrap
Applies toSee individual properties
InheritedSee individual properties
PercentagesSee individual properties
AnimationSee individual properties
SupportChrome 114 · Firefox 121 · Safari 17.4
Speccss-text-4
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
Even line lengths in headings; no lonely last word in paragraphs.

text-wrap-mode

Whether text wraps onto new lines at all. nowrap keeps each line whole, letting it overflow its container.

Syntaxwrap | nowrap
Initialwrap
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 130 · Firefox 124 · Safari 17.4
Speccss-text-4

text-wrap-style

How the browser chooses line breaks in wrapping text.

Syntaxauto | balance | stable | pretty | avoid-short-last-line
Initialauto
Applies toBlock containers that establish an inline formatting context
InheritedYes
AnimationDiscrete
SupportChrome 130 · Firefox 124 · Safari 17.5
Speccss-text-4
ValueEffect
autoThe browser's fast default, filling each line in turn.
balanceLines are made roughly equal in length. Meant for headings and other short text; browsers limit it to a few lines.
prettySlower, whole-paragraph line breaking that avoids very short last lines and uneven edges. Meant for body text.
stableLines before the one being edited do not reflow, which suits editable text.

overflow-wrap

Whether a word too long for its line may be broken at an arbitrary point to stop it overflowing, as long URLs often need. Its older name, word-wrap, still works as an alias.

Syntaxnormal | break-word | anywhere
Initialnormal
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 23 · Firefox 49 · Safari 7
Speccss-text-4

Both break-word and anywhere break a word only when there is no other way to fit it. The difference is sizing: anywhere counts those break points when working out the box's min-content width, so it also lets a shrink-to-fit box such as a flex item or table cell get narrower.

word-break

Where lines may break within words. Unlike overflow-wrap, it changes the break rules for all text, not just words that would overflow.

Syntaxnormal | break-all | keep-all | manual | auto-phrase | break-word
Initialnormal
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 1 · Firefox 15 · Safari 3
Speccss-text-4
ValueEffect
normalThe usual rules for each language.
break-allLines may break between any two letters, as they do in Chinese and Japanese.
keep-allLines may not break inside words in Chinese, Japanese or Korean text, only at spaces and punctuation.
auto-phraseLike keep-all, but breaks Japanese text between natural phrases. Chrome only; needs lang="ja".
break-wordLegacy; the same as word-break: normal with overflow-wrap: anywhere.

line-break

How strictly the line-breaking rules are applied, mainly for Chinese and Japanese, such as whether a line may begin with small kana or certain punctuation. anywhere allows a break between any two characters, even around punctuation.

Syntaxauto | loose | normal | strict | anywhere
Initialauto
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 58 · Firefox 69 · Safari 11
Speccss-text-4

hyphens

Whether words may be hyphenated at the end of a line. manual breaks only where the text contains a soft hyphen (&shy;) or a real hyphen; auto also lets the browser hyphenate using a dictionary for the element's language; none never hyphenates.

Syntaxnone | manual | auto
Initialmanual
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 55 · Firefox 43 · Safari 17
Speccss-text-4
<html lang="en-GB">
article p { hyphens: auto; }
Automatic hyphenation only works when the language is declared.

hyphenate-character

The string shown at the end of a line where a word is hyphenated. auto uses the right character for the language.

Syntaxauto | <string>
Initialauto
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 106 · Firefox 98 · Safari 17
Speccss-text-4

hyphenate-limit-chars

Limits automatic hyphenation by word length. Up to three values give the shortest word that may be hyphenated, the fewest characters before the break and the fewest after it.

Syntax[ auto | <integer [0,∞]> ]{1,3}
Initialauto
Applies toText
InheritedYes
AnimationBy computed value type
SupportChrome 109 · Firefox 137 · Safari no
Speccss-text-4
hyphenate-limit-chars: 8 3 3;
Only words of eight letters or more, leaving at least three on each side.

Transform & overflow

text-transform

Changes the case or form of characters for display, without changing the text in the document.

Syntaxnone | [capitalize | uppercase | lowercase ] || full-width || full-size-kana | math-auto
Initialnone
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-text-4
ValueEffect
uppercase / lowercaseAll letters in capitals or in lower case, following the rules of the element's language.
capitalizeThe first letter of each word in capitals; the rest are left alone.
full-widthCharacters are replaced with their full-width forms, so Latin letters line up with ideographs.
full-size-kanaSmall Japanese kana are shown full size, which helps legibility in ruby.
math-autoSingle-letter identifiers are shown in mathematical italic, as MathML's <mi> does.

text-overflow

What is shown where inline content is clipped at the end of a line: clip cuts it off, ellipsis shows "…". It only applies when the line actually overflows a box whose overflow is not visible.

Syntax[ clip | ellipsis | <string> | fade | <fade()> ]{1,2}
Initialclip
Applies toBlock containers
InheritedNo
PercentagesRefer to the width of the line box
AnimationBy computed value type
SupportChrome 1 · Firefox 7 · Safari 1.3
Speccss-overflow-4
.truncate {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
A single line cut short with an ellipsis.

text-fit

Scales text up or down so that it fills the width of its container. grow enlarges text that is too narrow and shrink reduces text that is too wide; consistent applies one scale to every line, while per-line scales each line separately.

Syntax[ none | grow | shrink ] [consistent | per-line | per-line-all]? <percentage>?
Initialnone
Applies toBlock containers
InheritedYes
AnimationDiscrete
SupportChrome 150 · Firefox no · Safari no
Speccss-text-5

Decoration

text-decoration

Shorthand for the line, thickness, style and colour of underlines, overlines and strike-throughs.

Syntax<'text-decoration-line'> || <'text-decoration-thickness'> || <'text-decoration-style'> || <'text-decoration-color'>
InitialSee individual properties
Applies toSee individual properties
InheritedSee individual properties
PercentagesSee individual properties
AnimationSee individual properties
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-text-decor-4

A decoration is drawn across all the text inside the element, including its descendants, and a descendant cannot remove it. Setting text-decoration: none on a child only stops the child adding its own. The early support versions cover the line keywords alone; the other parts arrived with each longhand.

a {
  text-decoration: underline 0.08em;
  text-underline-offset: 0.2em;
}
A thicker underline set a little further from the text.

text-decoration-line

Which lines are drawn: underline, overline, line-through, or a combination. blink is accepted but browsers do not make text blink.

Syntaxnone | [ underline || overline || line-through || blink ] | spelling-error | grammar-error
Initialnone
Applies toAll elements
InheritedNo (but the lines are drawn across descendants' text)
AnimationDiscrete
SupportChrome 57 · Firefox 36 · Safari 12.1
Speccss-text-decor-4

text-decoration-style

The style of the decoration lines: a single solid line, a double line, dotted, dashed or wavy.

Syntaxsolid | double | dotted | dashed | wavy
Initialsolid
Applies toAll elements
InheritedNo
AnimationDiscrete
SupportChrome 57 · Firefox 36 · Safari 12.1
Speccss-text-decor-4

text-decoration-color

The colour of the decoration lines. By default they match the text colour.

Syntax<color>
Initialcurrentcolor
Applies toAll elements
InheritedNo
AnimationBy computed value type
SupportChrome 57 · Firefox 36 · Safari 12.1
Speccss-text-decor-4

text-decoration-thickness

How thick the decoration lines are. from-font uses the thickness the font recommends; auto lets the browser choose. Lengths in em keep the line in proportion to the text.

Syntaxauto | from-font | <length-percentage> | <line-width>
Initialauto
Applies toAll elements
InheritedNo
AnimationBy computed value
SupportChrome 89 · Firefox 70 · Safari 12.1
Speccss-text-decor-4

text-decoration-skip-ink

Whether underlines and overlines break where they would cross a glyph, such as the descenders of g, j and y. none draws a continuous line through them.

Syntaxauto | none | all
Initialauto
Applies toAll elements
InheritedYes
AnimationDiscrete
SupportChrome 64 · Firefox 70 · Safari 15.4
Speccss-text-decor-4

text-decoration-skip-spaces

Whether decoration lines are drawn under spaces. The initial start end leaves out spaces at the start and end of the line; all skips every space; none draws under them all.

Syntaxnone | all | [ start || end ]
Initialstart end
Applies toAll elements
InheritedYes
AnimationDiscrete
SupportChrome 155 · Firefox no · Safari no
Speccss-text-decor-4

text-decoration-skip Deprecated

An older shorthand for which parts of the content decoration lines skip. Use text-decoration-skip-ink to control skipping around glyphs instead.

Syntaxnone | auto
InitialSee individual properties
Applies toAll elements
InheritedYes
AnimationDiscrete
SupportChrome 57 to 63 (removed in 64) · Firefox no · Safari 12.1
Speccss-text-decor-4

text-decoration-inset

Shortens or lengthens the decoration line at its start and end. Positive values pull the ends in; negative values extend the line past the text. One value sets both ends; two set start then end.

Syntax<length-percentage>{1,2} | auto
Initial0
Applies toAll elements
InheritedNo
PercentagesRefer to the inline size of the decorating box, or of each box fragment, depending on box-decoration-break
AnimationBy computed value
SupportChrome 157 · Firefox 146 · Safari no
Speccss-text-decor-4

text-underline-offset

Moves the underline away from its default position: positive values move it further from the text. Unlike the decoration longhands, it is inherited, so it can be set once on a container.

Syntaxauto | <length-percentage>
Initialauto
Applies toAll elements
InheritedYes
AnimationBy computed value
SupportChrome 87 · Firefox 70 · Safari 12.1
Speccss-text-decor-4

text-underline-position

Where the underline sits. from-font uses the position the font recommends; under puts it below the descenders, which keeps it clear of subscripts in chemical and mathematical text. left and right choose the side in vertical text.

Syntaxauto | [ from-font | under ] || [ left | right ]
Initialauto
Applies toAll elements
InheritedYes
AnimationDiscrete
SupportChrome 33 · Firefox 74 · Safari 12.1
Speccss-text-decor-4

text-shadow

One or more shadows drawn behind the text, each with a horizontal and vertical offset, an optional blur radius and a colour. The first shadow in the list is drawn on top.

Syntaxnone | <shadow>#
Initialnone
Applies toText
InheritedYes
AnimationAs shadow list
SupportChrome 2 · Firefox 3.5 · Safari 1.1
Speccss-text-decor-4
text-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
A soft shadow that lifts light text off a photograph.

Emphasis marks

text-emphasis

Shorthand for text-emphasis-style and text-emphasis-color: small marks drawn beside each character to emphasise it, the usual way to stress text in Chinese and Japanese. Their position is set separately with text-emphasis-position.

Syntax<'text-emphasis-style'> || <'text-emphasis-color'>
InitialSee individual properties
Applies toSee individual properties
InheritedSee individual properties
PercentagesSee individual properties
AnimationSee individual properties
SupportChrome 99 · Firefox 46 · Safari 7
Speccss-text-decor-4
em:lang(ja) { font-style: normal; text-emphasis: filled sesame; }
Japanese emphasis with sesame dots instead of italics.

text-emphasis-style

The shape of the emphasis marks: dot, circle, double-circle, triangle or sesame, each filled or open, or any single character given as a string.

Syntaxnone | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>
Initialnone
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 99 · Firefox 46 · Safari 7
Speccss-text-decor-4

text-emphasis-color

The colour of the emphasis marks. By default they match the text colour.

Syntax<color>
Initialcurrentcolor
Applies toText
InheritedYes
AnimationBy computed value type
SupportChrome 99 · Firefox 46 · Safari 7
Speccss-text-decor-4

text-emphasis-position

Which side of the text the emphasis marks go on: over or under in horizontal text, and right or left in vertical text. Japanese usually places them over; Chinese usually under.

Syntax[ over | under ] && [ right | left ]?
Initialover right
Applies toText
InheritedYes
AnimationDiscrete
SupportChrome 99 · Firefox 46 · Safari 7
Speccss-text-decor-4

Inline layout

line-height

The height of each line box, which spaces the lines of text. On a block it sets the minimum height of its lines; on an inline box it sets the height that box contributes.

Syntaxnormal | <number [0,∞]> | <length-percentage [0,∞]>
Initialnormal
Applies toNon-replaced inline boxes and SVG text content elements
InheritedYes
PercentagesRelative to the element's font size
AnimationBy computed value type
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-inline-3

Prefer a unitless number. It is inherited as a factor, so each descendant recalculates it from its own font size; a length or percentage is inherited as a fixed length and can be too tight for larger text.

body { line-height: 1.5; }
One and a half times the font size, at every size.

vertical-align

Shorthand for alignment-baseline, baseline-shift and baseline-source: how an inline-level box sits within its line, or how a table cell's content is aligned within the cell.

Syntax[ first | last] || <'alignment-baseline'> || <'baseline-shift'>
Initialbaseline
Applies toSee individual properties
InheritedNo
AnimationSee individual properties
SupportChrome 1 · Firefox 1 · Safari 1
Speccss-inline-3
ValueEffect
baselineThe box's baseline lines up with its parent's.
sub / superLowered or raised to the subscript or superscript position.
middleThe middle of the box lines up with the parent's baseline plus half its x-height.
text-top / text-bottomAligned to the top or bottom of the parent's font.
top / bottomAligned to the top or bottom of the whole line box.
<length-percentage>Raised by that amount (lowered if negative); percentages refer to line-height.

In a table cell, top, middle and bottom align the cell's content vertically. It has no effect on block-level boxes; use flexbox or grid alignment for those.

dominant-baseline

Which baseline a box uses to align the text and inline boxes inside it, such as alphabetic for Latin text, ideographic for Chinese and Japanese, hanging for scripts like Devanagari, or central. It is mostly used on SVG text.

Syntaxauto | <baseline-metric>
Initialauto
Applies toBlock containers, inline boxes, table rows, grid containers, flex containers and SVG text content elements
InheritedYes
AnimationDiscrete
SupportChrome 1 · Firefox 1 · Safari 4
Speccss-inline-3

<baseline-metric> is one of text-bottom, alphabetic, ideographic, middle, central, mathematical, hanging or text-top.

alignment-baseline

Which of a box's baselines is lined up with the matching baseline of its parent. Like dominant-baseline, it is mostly used on SVG text; in HTML, vertical-align sets it.

Syntaxbaseline | <baseline-metric>
Initialbaseline
Applies toInline-level boxes, flex items, grid items, table cells and SVG text content elements
InheritedNo
AnimationDiscrete
SupportChrome 1 · Firefox 149 · Safari 5.1
Speccss-inline-3

baseline-shift

Raises or lowers a box from its aligned position. Positive lengths raise it; sub and super move it to the subscript or superscript position.

Syntax<length-percentage> | sub | super | top | center | bottom
Initial0
Applies toInline-level boxes and SVG text content elements
InheritedNo
PercentagesRefer to the used value of line-height
AnimationBy computed value type
SupportChrome 1 · Firefox 149 · Safari 4
Speccss-inline-3

baseline-source

Whether an inline-level box with several lines aligns by its first or last line's baseline. auto uses the last baseline for inline blocks and the first for everything else, which is why a multi-line inline block sits by its bottom line.

Syntaxauto | first | last
Initialauto
Applies toInline-level boxes that establish an independent formatting context
InheritedNo
AnimationDiscrete
SupportChrome 111 · Firefox 115 · Safari no
Speccss-inline-3

text-box

Shorthand for text-box-trim and text-box-edge: trims the space a font reserves above and below its letters, so that text can be aligned to its cap height or baseline instead of to the edges of the line box.

Syntaxnormal | <'text-box-trim'> || <'text-box-edge'>
Initialnormal
Applies toBlock containers, multi-column containers and inline boxes
InheritedNo
AnimationDiscrete
SupportChrome 133 · Firefox 154 · Safari 18.2
Speccss-inline-3
.button { text-box: trim-both cap alphabetic; }
Padding is measured from the tops of the capitals and the baseline, so the label looks truly centred.

text-box-trim

Which sides are trimmed: trim-start trims above the first line, trim-end below the last line, and trim-both both.

Syntaxnone | trim-start | trim-end | trim-both
Initialnone
Applies toBlock containers, multi-column containers and inline boxes
InheritedNo
AnimationDiscrete
SupportChrome 133 · Firefox 154 · Safari 18.2
Speccss-inline-3

text-box-edge

Which font metrics the trim cuts to. The first keyword is the top edge (text, cap, ex, ideographic or ideographic-ink) and the second the bottom edge (text, alphabetic, ideographic or ideographic-ink).

Syntaxauto | <text-edge>
Initialauto
Applies toBlock containers and inline boxes
InheritedYes
AnimationDiscrete
SupportChrome 133 · Firefox 154 · Safari 18.2
Speccss-inline-3

A single keyword such as text or ideographic sets both edges.

initial-letter

Makes a drop cap or raised initial. The first number is the letter's size in lines of text; the optional second is how many lines it sinks into the paragraph.

Syntaxnormal | <number [1,∞]> <integer [1,∞]> | <number [1,∞]> && [ drop | raise ]?
Initialnormal
Applies to::first-letter, inline-level boxes at the start of a block and inside ::marker boxes (see the spec)
InheritedNo
AnimationBy computed value type
SupportChrome 110 · Firefox no · Safari no
Speccss-inline-3
p:first-of-type::first-letter { initial-letter: 3; }
A drop cap three lines tall, sunk three lines.

Safari supports it only with the -webkit- prefix.

Ruby

ruby-position

Where ruby annotations (the small reading aids set beside East Asian text) are placed: over puts them above horizontal text, under below it. alternate, the initial value, places a single annotation over and alternates sides when there are two levels.

Syntax[ alternate || [ over | under ] ] | inter-character
Initialalternate
Applies toRuby annotation containers
InheritedYes
AnimationDiscrete
SupportChrome 84 · Firefox 38 · Safari 18.2
Speccss-ruby-1
rt { ruby-position: under; }
Annotations below the base text, as in many Chinese textbooks.

ruby-align

How ruby text is spread across its base, or a base across its annotation, when one is shorter than the other: at the start, in the center, or with the spare space distributed by space-between or space-around.

Syntaxstart | center | space-between | space-around
Initialspace-around
Applies toRuby bases, ruby annotations, ruby base containers and ruby annotation containers
InheritedYes
AnimationBy computed value type
SupportChrome 128 · Firefox 38 · Safari 18.2
Speccss-ruby-1

ruby-overhang

Whether a ruby annotation wider than its base may hang over the neighbouring text instead of pushing it apart.

Syntaxauto | spaces
Initialauto
Applies toRuby annotation containers
InheritedYes
AnimationBy computed value type
SupportChrome 151 · Firefox no · Safari 18.2
Speccss-ruby-1

Math layout

math-depth

The nesting depth of an element within a MathML formula, which font-size: math uses to make scripts and nested fractions progressively smaller. auto-add adds one when the parent's math-style is compact; add() adds a given amount; an integer sets the depth outright.

Syntaxauto-add | add(<integer>) | <integer>
Initial0
Applies toAll elements
InheritedYes
AnimationBy computed value type
SupportChrome 109 · Firefox 117 · Safari 26.4
Specmathml-core

The browser's MathML style sheet already sets it on scripts, so you rarely need to set it yourself.

math-shift

How high superscripts are raised in MathML. compact uses a smaller shift, as in denominators and under radicals, where space is tight.

Syntaxnormal | compact
Initialnormal
Applies toAll elements
InheritedYes
AnimationBy computed value type
SupportChrome 109 · Firefox 146 · Safari 26.2
Specmathml-core

math-style

Whether a MathML formula is laid out in display style (normal), with full-size operators and limits above and below, or in the more compact inline style (compact) that fits within a line of text.

Syntaxnormal | compact
Initialnormal
Applies toAll elements
InheritedYes
AnimationBy computed value type
SupportChrome 109 · Firefox 117 · Safari 14.1
Specmathml-core

Text size adjustment

text-size-adjust

Controls the automatic enlargement of text that some mobile browsers apply to pages not designed for small screens. none turns it off; a percentage sets the enlargement factor.

Syntaxauto | none | <percentage [0,∞]>
Initialauto
Applies toAll elements
InheritedYes
PercentagesThe percentage itself is the adjustment factor for the font size
AnimationBy computed value
SupportChrome 54 · Firefox no · Safari no
Speccss-size-adjust-1

Safari on iOS supports it with the -webkit- prefix. A page with a proper <meta name="viewport"> tag is not enlarged in the first place.

Compatibility (-webkit-) properties

These prefixed properties began in WebKit, but so much of the web depends on them that every browser now supports them, and the Compat Standard defines them.

-webkit-line-clamp

Cuts a block's content off after a given number of lines and puts an ellipsis at the end of the last one. It only works together with display: -webkit-box and -webkit-box-orient: vertical, and usually overflow: hidden.

Syntaxnone | <integer [1,∞]>
Initialnone
Applies toSee individual properties
InheritedSee individual properties
AnimationSee individual properties
SupportChrome 6 · Firefox 68 · Safari 5
Speccompat
.summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
At most three lines, ending in an ellipsis.

-webkit-text-fill-color

The colour used to fill the glyphs of text, overriding color for the fill only. Setting it to transparent together with background-clip: text lets a gradient or image show through the letters.

Syntax<color>
Initialcurrentcolor
Applies toAll elements
InheritedYes
AnimationBy computed value type
SupportChrome 1 · Firefox 49 · Safari 3
Speccompat
h1 {
  background: linear-gradient(90deg, teal, purple);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
Gradient-filled heading text.

-webkit-text-stroke

Shorthand for -webkit-text-stroke-width and -webkit-text-stroke-color: an outline drawn along the edges of each glyph.

Syntax<line-width> || <color>
InitialSee individual properties
Applies toSee individual properties
InheritedYes
AnimationSee individual properties
SupportChrome 4 · Firefox 49 · Safari 3
Speccompat

The stroke is centred on the glyph outline, so a thick stroke eats into the letter's fill as well as growing outwards.

-webkit-text-stroke: 1px currentcolor;
-webkit-text-fill-color: transparent;
Outline-only lettering.

-webkit-text-stroke-width

The width of the outline drawn around text. <line-width> is a non-negative length or one of thin, medium and thick.

Syntax<line-width>
Initial0
Applies toAll elements
InheritedYes
AnimationDiscrete
SupportChrome 1 · Firefox 49 · Safari 3
Speccompat

-webkit-text-stroke-color

The colour of the outline drawn around text. By default it matches the text colour.

Syntax<color>
Initialcurrentcolor
Applies toAll elements
InheritedYes
AnimationBy computed value type
SupportChrome 1 · Firefox 49 · Safari 3
Speccompat