CSS Reference ยท Typography
The text-emphasis property
Reference for the CSS text-emphasis shorthand: add dots, circles, triangles or sesame marks above or below text, set their color, and combine them with position.
The text-emphasis property draws a small mark next to every character of the text, a traditional way to emphasize words in East Asian typography. The marks are not underlines: each character gets its own dot, circle or other shape, placed above or below it.
It is a shorthand for text-emphasis-style (which shape) and text-emphasis-color (what color). The position is set separately with text-emphasis-position.
.key-term { text-emphasis: filled circle crimson; }
Try it
Syntax
text-emphasis: <'text-emphasis-style'> || <'text-emphasis-color'> /* text-emphasis-style */ none | [ [ filled | open ] || [ dot | circle | double-circle | triangle | sesame ] ] | <string>
- Initial value:
nonefor the style andcurrentcolorfor the color - Applies to: all elements
- Inherited: yes
- Animatable: the color part is animatable; the style is not
- Computed value: as the two longhands
Values
| Value | Description |
|---|---|
none |
No emphasis marks. |
filled / open |
Solid or hollow version of the shape. If only a shape is given, filled is assumed. |
dot, circle, double-circle, triangle, sesame |
Built-in mark shapes. If only filled or open is given, the shape defaults to circle in vertical text and dot in horizontal text. |
<string> |
A custom mark (the first character of the string is used). |
<color> |
Mark color. Defaults to the text color. |
Usage notes
- Where marks go. By default, marks appear above the text in horizontal writing, and on the right in vertical writing. Use
text-emphasis-position(over,under, withleftorright) to change it. - Spaces get no marks. Whitespace and control characters are skipped.
- Line spacing. Marks need room. If the
line-heightis too tight, the browser may increase the height of the line to fit them, so give emphasized text some breathing space. - Not a replacement for strong or em. Emphasis marks are decoration. For meaning, keep using semantic elements such as
<em>and<strong>. - Latin text works too, but the effect is unusual for English, so use it sparingly.
- Color independence. Marks use the text color unless you set one. Check contrast if you pick a different color.
Browser support
The unprefixed shorthand works in current versions of the major browsers; older versions used a -webkit- prefix, so check a compatibility table if you must support them.
Related
text-decorationโ underlines and strike-throughstext-shadowโ shadows behind textwriting-modeโ vertical text- Lesson: Text Styling