CSS text-emphasis Property
The CSS text-emphasis property is a shorthand that adds emphasis marks to text and controls their shape and color.
Emphasis marks are small symbols displayed alongside individual characters. They are commonly used in East Asian typography, particularly Japanese and Chinese text, to highlight words or phrases without changing their font weight or adding underlines.
The shorthand combines text-emphasis-style and text-emphasis-color. The position of the marks is controlled separately using text-emphasis-position.
text-emphasis Syntax
The text-emphasis shorthand accepts an emphasis style, an emphasis color, or both.
Basic Syntax
.example {
text-emphasis: filled circle red;
}
Available Values
.example {
text-emphasis: none;
}
.example {
text-emphasis: auto;
}
.example {
text-emphasis: dot;
}
.example {
text-emphasis: filled circle;
}
.example {
text-emphasis: open sesame;
}
.example {
text-emphasis: filled dot blue;
}
.example {
text-emphasis: "★" red;
}
.example {
text-emphasis: #2563eb;
}
When only a color is supplied, the shorthand resets the emphasis style to its initial value, none. A style must be present for marks to appear.
CSS-Wide Keywords
.example {
text-emphasis: initial;
}
.example {
text-emphasis: inherit;
}
.example {
text-emphasis: unset;
}
.example {
text-emphasis: revert;
}
.example {
text-emphasis: revert-layer;
}
The shorthand's initial values are none for emphasis style and currentColor for emphasis color. Both longhand properties are inherited, so unset behaves like inherit.
Valid Examples
.example {
text-emphasis: filled dot;
}
.example {
text-emphasis: open circle green;
}
.example {
text-emphasis: double-circle #7c3aed;
}
.example {
text-emphasis: filled triangle;
}
.example {
text-emphasis: "◆" #dc2626;
}
Invalid Examples
.example {
text-emphasis: bold;
}
.example {
text-emphasis: underline;
}
.example {
text-emphasis: 3px;
}
.example {
text-emphasis: filled open dot;
}
.example {
text-emphasis: dot circle;
}
Font weights, decoration lines, lengths, conflicting fill keywords, and multiple shape keywords are not valid shorthand combinations.
Property Values
| Value | Description |
|---|---|
none |
Displays no emphasis marks. |
auto |
Lets the browser choose an appropriate emphasis mark shape. |
filled |
Uses the filled version of the selected mark shape. |
open |
Uses the outlined version of the selected mark shape. |
dot |
Uses a small dot-shaped emphasis mark. |
circle |
Uses a circular emphasis mark. |
double-circle |
Uses a double-circle emphasis mark. |
triangle |
Uses a triangular emphasis mark. |
sesame |
Uses a sesame-shaped emphasis mark. |
<string> |
Uses the supplied string as a custom emphasis mark. |
<color> |
Sets the color of the emphasis marks. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | none currentColor |
| Inherited | Yes |
| Applies to | All elements |
| Computed value | See individual longhand properties |
| Animation type | See individual longhand properties |
| Percentages | Not applicable |
| Longhand properties | text-emphasis-style, text-emphasis-color |
| Specification | CSS Text Decoration Module Level 3 |
Note: The text-emphasis-position property is not part of this shorthand and must be specified separately.
How It Works
Text emphasis marks are drawn alongside individual characters rather than as continuous lines.
Step 1: Select an Element
<p class="emphasized">Important text</p>
Step 2: Add Emphasis Marks
.emphasized {
text-emphasis: filled dot;
}
The browser draws filled dot marks alongside eligible characters.
Step 3: Change the Color
.emphasized {
text-emphasis: filled dot #2563eb;
}
The marks become blue while the text retains its normal color.
Step 4: Change the Shape
.emphasized {
text-emphasis: open circle #2563eb;
}
The marks change from filled dots to outlined circles.
Step 5: Control the Position
.emphasized {
text-emphasis: filled dot #2563eb;
text-emphasis-position: under right;
}
In horizontal writing, the marks appear beneath the text. In vertical writing, the right-side positioning is used.
Important Consideration
Emphasis marks are not normally drawn over spaces or certain punctuation characters. The browser follows text emphasis rules when deciding which characters receive marks.
Emphasis Mark Shapes
CSS provides five named emphasis mark shapes. Each can be displayed as a filled or open mark.
Dot
.example {
text-emphasis: filled dot;
}
Uses a small filled dot, commonly associated with traditional East Asian emphasis.
Circle
.example {
text-emphasis: filled circle;
}
Uses a filled circular mark.
Double-Circle
.example {
text-emphasis: filled double-circle;
}
Uses a double-circle symbol.
Triangle
.example {
text-emphasis: filled triangle;
}
Uses a triangular mark.
Sesame
.example {
text-emphasis: filled sesame;
}
Uses a small sesame-shaped mark, often associated with vertical East Asian typography.
Automatic Shape Selection
.example {
text-emphasis: auto;
}
The browser chooses an emphasis mark appropriate for the writing mode and text.
Important Consideration
The exact appearance of each mark depends on the browser and available fonts. Named marks are rendered using typographic symbols rather than CSS border shapes.
Filled and Open Marks
The filled and open keywords determine whether the selected emphasis shape appears filled or outlined.
Filled Dot
.example {
text-emphasis: filled dot;
}
Open Dot
.example {
text-emphasis: open dot;
}
Filled Circle
.example {
text-emphasis: filled circle;
}
Open Circle
.example {
text-emphasis: open circle;
}
Filled Triangle
.example {
text-emphasis: filled triangle;
}
Open Triangle
.example {
text-emphasis: open triangle;
}
Default Fill Behavior
.example {
text-emphasis: circle;
}
When a named shape is supplied without filled or open, the filled version is used.
Important Consideration
The fill keywords apply to named shapes. They cannot be combined with a custom string value.
Custom Emphasis Marks
A quoted string can be used instead of a predefined emphasis shape. This provides additional control over the symbol displayed beside each eligible character.
Star Mark
.example {
text-emphasis: "★";
}
Diamond Mark
.example {
text-emphasis: "◆";
}
Bullet Mark
.example {
text-emphasis: "•";
}
Colored Custom Mark
.example {
text-emphasis: "★" #dc2626;
}
Custom Mark With Position
.example {
text-emphasis: "◆" #7c3aed;
text-emphasis-position: under right;
}
Using Unicode Escapes
.example {
text-emphasis: "\2605" #2563eb;
}
The Unicode escape \2605 represents a black star character.
Important Consideration
Custom emphasis strings are intended for short marks, typically one character. Longer strings may overlap adjacent marks or produce inconsistent results. The browser may truncate the string to a single character.
Emphasis Mark Colors
The shorthand accepts standard CSS color values to control the appearance of emphasis marks independently of the text color.
Named Color
.example {
text-emphasis: filled dot red;
}
Hexadecimal Color
.example {
text-emphasis: filled circle #2563eb;
}
RGB Color
.example {
text-emphasis: open circle rgb(5 150 105);
}
HSL Color
.example {
text-emphasis: filled triangle hsl(270 70% 50%);
}
Using currentColor
.example {
color: #2563eb;
text-emphasis: filled dot currentColor;
}
The emphasis marks use the current text color.
Separate Text and Mark Colors
.example {
color: #1f2937;
text-emphasis: filled dot #dc2626;
}
The text remains dark gray while the emphasis marks appear red.
Important Consideration
If no color is specified, emphasis marks use currentColor. This normally makes the marks match the text color.
Emphasis Mark Position
The text-emphasis-position property determines where emphasis marks appear relative to the text.
It is a separate property and is not included in the text-emphasis shorthand.
Above Horizontal Text
.example {
writing-mode: horizontal-tb;
text-emphasis: filled dot #2563eb;
text-emphasis-position: over right;
}
The marks appear above the horizontal text.
Below Horizontal Text
.example {
writing-mode: horizontal-tb;
text-emphasis: filled dot #2563eb;
text-emphasis-position: under right;
}
The marks appear below the horizontal text.
Right of Vertical Text
.example {
writing-mode: vertical-rl;
text-emphasis: filled sesame #2563eb;
text-emphasis-position: over right;
}
The marks appear on the right side of the vertical text.
Left of Vertical Text
.example {
writing-mode: vertical-rl;
text-emphasis: filled sesame #2563eb;
text-emphasis-position: over left;
}
The marks appear on the left side of the vertical text.
Important Consideration
The over and under keywords control the side of the line box used for emphasis marks. The left and right keywords determine their placement in vertical writing modes.
Writing Modes
Text emphasis is particularly useful in vertical writing systems, where marks are positioned beside characters instead of above or below a horizontal line.
Horizontal Writing
.horizontal-text {
writing-mode: horizontal-tb;
text-emphasis: filled dot #2563eb;
}
Marks appear above the text by default.
Vertical Right-to-Left Writing
.vertical-text {
writing-mode: vertical-rl;
text-emphasis: filled sesame #2563eb;
}
The text flows vertically, and emphasis marks appear beside the characters.
Vertical Left-to-Right Writing
.vertical-text {
writing-mode: vertical-lr;
text-emphasis: open circle #059669;
}
Japanese Text Example
<p lang="ja" class="japanese-emphasis">重要な文章</p>
.japanese-emphasis {
text-emphasis: filled sesame #dc2626;
}
Emphasis marks are displayed alongside the Japanese characters.
Important Consideration
Use appropriate language attributes and writing modes when presenting multilingual content. Emphasis marks should follow the typographic conventions of the language being displayed.
Shorthand Behavior
The text-emphasis shorthand sets both text-emphasis-style and text-emphasis-color.
Equivalent Longhand Declarations
.example {
text-emphasis-style: filled dot;
text-emphasis-color: #2563eb;
}
Equivalent Shorthand
.example {
text-emphasis: filled dot #2563eb;
}
Setting Only the Style
.example {
text-emphasis: filled circle;
}
The color is reset to currentColor.
Setting Only the Color
.example {
text-emphasis: #dc2626;
}
The style is reset to none, so no marks appear unless another declaration subsequently establishes an emphasis style.
Shorthand Reset Example
.example {
text-emphasis-style: filled dot;
text-emphasis-color: blue;
text-emphasis: open circle;
}
The final declaration changes the style to open circle and resets the color to currentColor.
Preserving the Color
.example {
text-emphasis: open circle;
text-emphasis-color: blue;
}
The later longhand declaration sets the color without changing the emphasis style.
Position Is Not Reset
.example {
text-emphasis-position: under right;
text-emphasis: filled dot red;
}
The shorthand does not reset text-emphasis-position.
Practical Examples
Japanese Emphasis Marks
.japanese-text {
text-emphasis: filled sesame;
}
Adds traditional-style emphasis marks to Japanese text.
Colored Dot Emphasis
.highlighted-text {
text-emphasis: filled dot #2563eb;
}
Displays blue dots above the text.
Open Circle Emphasis
.special-text {
text-emphasis: open circle #059669;
}
Uses outlined green circles.
Triangle Emphasis
.important-label {
text-emphasis: filled triangle #dc2626;
}
Displays red triangular marks.
Custom Star Emphasis
.featured-text {
text-emphasis: "★" #f59e0b;
}
Uses star characters as emphasis marks.
Emphasis Beneath Text
.under-emphasis {
text-emphasis: filled dot #7c3aed;
text-emphasis-position: under right;
}
Positions purple dots beneath horizontal text.
Vertical Text Emphasis
.vertical-emphasis {
writing-mode: vertical-rl;
text-emphasis: filled sesame #2563eb;
text-emphasis-position: over right;
}
Displays sesame-shaped marks beside vertical text.
Inherited Emphasis
.emphasis-container {
text-emphasis: filled dot #2563eb;
}
Descendant text can inherit the emphasis style and color.
Removing Emphasis
.no-emphasis {
text-emphasis: none;
}
Removes emphasis marks from the selected text.
Hover Emphasis
.interactive-label {
text-emphasis: none;
}
.interactive-label:hover {
text-emphasis: filled dot #2563eb;
}
Adds emphasis marks when the pointer hovers over the element. Important information should not depend on hover alone.
text-emphasis Example
This example compares several emphasis mark shapes and colors using Japanese text, where individual character marks are easy to distinguish.
HTML Example
<div class="text-emphasis-demo" lang="ja">
<div class="emphasis-sample">
<strong>Filled Dot</strong>
<p class="emphasis-dot">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Open Circle</strong>
<p class="emphasis-circle">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Double-Circle</strong>
<p class="emphasis-double">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Filled Triangle</strong>
<p class="emphasis-triangle">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Filled Sesame</strong>
<p class="emphasis-sesame">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Custom Star</strong>
<p class="emphasis-star">重要な文章</p>
</div>
</div>
CSS Example
.text-emphasis-demo {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
}
.text-emphasis-demo .emphasis-sample {
padding: 18px 16px;
border: 1px solid #cbd5e1;
background: #f8fafc;
}
.text-emphasis-demo strong {
display: block;
margin-bottom: 18px;
color: #334155;
font-size: 14px;
}
.text-emphasis-demo p {
margin: 0;
padding-top: 10px;
color: #1f2937;
font-size: 26px;
line-height: 2;
text-emphasis-position: over right;
}
.text-emphasis-demo .emphasis-dot {
text-emphasis: filled dot #2563eb;
}
.text-emphasis-demo .emphasis-circle {
text-emphasis: open circle #059669;
}
.text-emphasis-demo .emphasis-double {
text-emphasis: filled double-circle #7c3aed;
}
.text-emphasis-demo .emphasis-triangle {
text-emphasis: filled triangle #dc2626;
}
.text-emphasis-demo .emphasis-sesame {
text-emphasis: filled sesame #ea580c;
}
.text-emphasis-demo .emphasis-star {
text-emphasis: "★" #ca8a04;
}
重要な文章
重要な文章
重要な文章
重要な文章
重要な文章
重要な文章
Comparing the Results
| Style | Expected Appearance |
|---|---|
filled dot |
Small filled dots above eligible characters. |
open circle |
Outlined circular marks. |
filled double-circle |
Double-circle emphasis marks. |
filled triangle |
Filled triangular marks. |
filled sesame |
Sesame-shaped marks. |
"★" |
Custom star-shaped marks. |
The exact mark appearance depends on browser rendering and font availability.
Changing the Mark Position
.text-emphasis-demo p {
text-emphasis-position: under right;
}
The emphasis marks move beneath the horizontal text.
Changing the Text Color
.text-emphasis-demo p {
color: #475569;
}
The text color changes while the explicitly specified emphasis mark colors remain unchanged.
Using a Different Writing Mode
.text-emphasis-demo p {
writing-mode: vertical-rl;
height: 180px;
}
The text flows vertically, and the emphasis marks appear beside the characters.
Accessibility Considerations
Text emphasis marks are primarily visual and should not be the only way important information is communicated.
Do Not Rely on Marks Alone
Use clear wording or semantic HTML when emphasis communicates meaning.
Maintain Color Contrast
Choose emphasis mark colors that remain distinguishable from the background.
Avoid Excessive Decoration
Applying marks to large amounts of text can make content harder to read.
Use Appropriate Language Attributes
Specify the language of multilingual content using the HTML lang attribute.
Test Vertical Writing
Verify that emphasis marks remain visible and correctly positioned in vertical writing modes.
Do Not Assume Screen Readers Announce Marks
Emphasis marks are not a reliable source of spoken information. Important meaning should be included in the text itself.
Preserve Readability
Avoid custom symbols that overlap text or create visual clutter.
Consider Cultural Typography
Use emphasis styles appropriate to the language and writing conventions of the content.
Common Mistakes
Using Font Weight Keywords
.example {
text-emphasis: bold;
}
Use font-weight to control bold text.
Using Underline Values
.example {
text-emphasis: underline;
}
Use text-decoration for underlines.
Using Length Values
.example {
text-emphasis: 3px;
}
The shorthand does not accept a length for mark size.
Combining Conflicting Fill Keywords
.example {
text-emphasis: filled open circle;
}
Choose either filled or open.
Combining Multiple Shapes
.example {
text-emphasis: dot triangle;
}
Only one named shape can be specified.
Using an Unquoted Custom Symbol
.example {
text-emphasis: ★;
}
Custom marks must be supplied as quoted strings.
Correct Custom Symbol
.example {
text-emphasis: "★";
}
Assuming a Color Alone Creates Marks
.example {
text-emphasis: red;
}
The shorthand resets the style to none, so no emphasis marks appear.
Trying to Set Position in the Shorthand
.example {
text-emphasis: filled dot over;
}
Use text-emphasis-position separately.
Expecting Marks on Spaces
Emphasis marks are not normally drawn over spaces or certain punctuation characters.
Expecting Identical Marks Across Browsers
The appearance of marks can vary depending on the browser and available fonts.
Assuming Emphasis Marks Change Layout Dimensions
Emphasis marks are painted alongside text and do not normally change line box dimensions.
Important Considerations
Keep the following points in mind when using text-emphasis:
- The property is a shorthand for
text-emphasis-styleandtext-emphasis-color. - The property adds emphasis marks alongside individual characters.
- The initial emphasis style is
none. - The initial emphasis color is
currentColor. - Both longhand properties are inherited.
- Named shapes include
dot,circle,double-circle,triangle, andsesame. - Named shapes can use
filledoropen. - The default fill for named shapes is
filled. - The
autovalue allows the browser to choose an appropriate shape. - Custom marks can be supplied using quoted strings.
- Custom strings should normally contain one character.
- CSS color values can control emphasis mark colors.
- Marks use the current text color when no separate color is specified.
- Specifying only a color resets the emphasis style to
none. - Specifying only a style resets the emphasis color to
currentColor. - The shorthand does not include
text-emphasis-position. - Use
text-emphasis-positionto control mark placement. - Marks normally appear above horizontal text by default.
- Marks appear beside characters in vertical writing modes.
- Emphasis marks are commonly used in East Asian typography.
- Marks are not normally drawn over spaces or certain punctuation.
- Browser and font differences can affect mark appearance.
- Emphasis marks do not change the font weight of the text.
- Emphasis marks do not create underlines or strikethroughs.
- Marks do not normally change line box dimensions.
- Use appropriate HTML language attributes for multilingual content.
- Do not rely on visual emphasis marks alone to communicate important meaning.
- Test custom marks for readability and spacing.
- Verify rendering in horizontal and vertical writing modes.
Browser Support
The CSS text-emphasis property is widely available in modern browsers, including Chrome, Edge, Firefox, and Safari.
Named emphasis shapes, colors, and custom strings are supported in current major browsers. The exact appearance of emphasis marks may vary with fonts and browser rendering.
For current compatibility information, visit Can I Use? and search for text-emphasis.
Basic Compatibility
.example {
text-emphasis: filled dot #2563eb;
}
Filled dot emphasis is supported in current major browsers.
Custom Emphasis Marks
.example {
text-emphasis: "★" #dc2626;
}
Custom string marks are also supported in modern browsers.
Feature Detection
@supports (text-emphasis: filled dot) {
.example {
text-emphasis: filled dot #2563eb;
}
}
This checks whether the browser recognizes the emphasis shorthand.
Fallback Example
.example {
font-weight: bold;
}
@supports (text-emphasis: filled dot) {
.example {
font-weight: normal;
text-emphasis: filled dot #2563eb;
}
}
Browsers without support retain bold text, while supporting browsers use emphasis marks.
Testing Recommendations
Test the chosen mark shapes with the fonts and writing modes used on the page. Pay particular attention to custom symbols and vertical text.
Specifications
The text-emphasis shorthand is defined in the CSS Text Decoration Module Level 3 specification.
CSS Text Decoration Module Level 3 - text-emphasis Property
The specification defines emphasis mark styles, colors, and their use with different writing modes.
For additional documentation and examples, consult MDN Web Docs.
