CSS Reference ยท Typography
The text-rendering property
Reference for the CSS text-rendering property: auto, optimizeSpeed, optimizeLegibility and geometricPrecision, what each hints to the browser, and why effects are often subtle.
The text-rendering property is a hint to the browser about what to favor when drawing text: rendering speed, legibility (kerning and ligatures), or exact geometry when text is scaled. It is a hint, not a command, and browsers are free to ignore parts of it.
Modern browsers already turn on kerning and common ligatures for most text, so in practice the visible difference is small. The property began in SVG and is mostly useful for fine-tuning.
h1 { text-rendering: optimizeLegibility; }
Try it
Do not expect big differences. Depending on your browser and font, the four lines may look identical or differ only in the spacing of pairs like "AV" and "Wa", or in the "ffi" ligature.
Syntax
text-rendering: auto | optimizeSpeed | optimizeLegibility | geometricPrecision
- Initial value:
auto - Applies to: text
- Inherited: yes
- Animatable: no
- Computed value: as specified
Values
| Value | Description |
|---|---|
auto |
The browser decides, usually balancing speed and quality based on text size. |
optimizeSpeed |
Favors speed over quality, and may disable kerning and ligatures. |
optimizeLegibility |
Favors legibility: kerning and ligatures are enabled where the font offers them. |
geometricPrecision |
Favors accurate geometry, so that text scales smoothly and layout stays consistent at different sizes. |
Usage notes
- Kerning and ligatures are better controlled directly. For predictable results, use
font-kerningandfont-variant-ligaturesrather than relying on this hint. - Browser differences. Engines treat the values differently, and some map several of them to the same behavior.
- Large pages. Older advice said
optimizeLegibilitycan slow down rendering of long documents, so apply it to headings rather than tobody. - Scaled text.
geometricPrecisionis mainly useful when text is zoomed or animated with transforms and you want smooth, proportional glyph positioning. - Letter-spacing. Non-zero
letter-spacingturns off optional ligatures regardless of this property. - Do not use it for fixes. If text looks wrong, the cause is usually the font, hinting or the operating system, not this property.
Browser support
Supported in current browsers, though the exact effect of each value varies by engine and platform.
Related
font-kerningโ kerning controlfont-variant-ligaturesโ ligature controlfont-optical-sizingโ optical sizes in variable fontsletter-spacing- Lesson: Fonts