CSS text-emphasis-position Property
The CSS text-emphasis-position property controls where emphasis marks appear relative to text characters.
Emphasis marks are small symbols placed above, below, or beside individual characters. The property is especially useful for East Asian typography, where emphasis marks are commonly used with horizontal and vertical writing modes.
Use text-emphasis-style to select the marks and text-emphasis-color to set their color. The text-emphasis-position property controls placement independently of those settings.
text-emphasis-position Syntax
The property accepts over or under, optionally combined with left or right.
Basic Syntax
.example {
text-emphasis-position: over right;
}
Available Values
.example {
text-emphasis-position: over;
}
.example {
text-emphasis-position: under;
}
.example {
text-emphasis-position: over right;
}
.example {
text-emphasis-position: over left;
}
.example {
text-emphasis-position: under right;
}
.example {
text-emphasis-position: under left;
}
The left and right keywords may also precede over or under.
CSS-Wide Keywords
.example {
text-emphasis-position: initial;
}
.example {
text-emphasis-position: inherit;
}
.example {
text-emphasis-position: unset;
}
.example {
text-emphasis-position: revert;
}
.example {
text-emphasis-position: revert-layer;
}
The initial value is over right. The property is inherited, so unset behaves like inherit.
Valid Examples
.example {
text-emphasis-position: under right;
}
.example {
text-emphasis-position: over left;
}
.example {
text-emphasis-position: right under;
}
Invalid Examples
.example {
text-emphasis-position: center;
}
.example {
text-emphasis-position: top;
}
.example {
text-emphasis-position: 10px;
}
.example {
text-emphasis-position: over under;
}
.example {
text-emphasis-position: left right;
}
The property does not accept arbitrary positions, lengths, or conflicting keywords.
Property Values
| Value | Description |
|---|---|
over |
Positions marks over horizontal text. In vertical writing, it uses the writing mode's over side. |
under |
Positions marks under horizontal text. In vertical writing, it uses the opposite side from over. |
right |
Positions marks on the right side in vertical writing when combined with over or under. |
left |
Positions marks on the left side in vertical writing when combined with over or under. |
Common Combinations
| Value | Horizontal Writing | Vertical Writing |
|---|---|---|
over right |
Above text | Right of text |
over left |
Above text | Left of text |
under right |
Below text | Right of text |
under left |
Below text | Left of text |
In horizontal writing, the left and right keywords do not change the visible position. In vertical writing, they determine which side of the text receives the marks.
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | over right |
| Inherited | Yes |
| Applies to | All elements |
| Computed value | Specified keywords |
| Animation type | Discrete |
| Percentages | Not applicable |
| Shorthand | Not included in text-emphasis |
| Specification | CSS Text Decoration Module Level 3 |
How It Works
The browser uses the element's writing mode and the specified position keywords to determine where emphasis marks should be painted.
Step 1: Create Emphasis Marks
.example {
text-emphasis-style: filled dot;
}
Filled dots appear in their default position.
Step 2: Position Marks Above Text
.example {
text-emphasis-style: filled dot;
text-emphasis-position: over right;
}
In horizontal writing, the dots appear above the characters.
Step 3: Position Marks Below Text
.example {
text-emphasis-style: filled dot;
text-emphasis-position: under right;
}
The dots move beneath horizontal text.
Step 4: Add a Color
.example {
text-emphasis: filled dot #2563eb;
text-emphasis-position: under right;
}
The marks appear blue and remain beneath the text.
Step 5: Use Vertical Writing
.example {
writing-mode: vertical-rl;
text-emphasis: filled sesame #2563eb;
text-emphasis-position: over right;
}
The text flows vertically, with blue sesame-shaped marks on its right side.
Important Consideration
Positioning only affects visible emphasis marks. If text-emphasis-style is none, changing the position produces no visible effect.
Horizontal Text
In horizontal writing modes, emphasis marks can appear above or below the characters.
Marks Above Text
.example {
writing-mode: horizontal-tb;
text-emphasis: filled dot #2563eb;
text-emphasis-position: over right;
}
The dots appear above the text.
Marks Below Text
.example {
writing-mode: horizontal-tb;
text-emphasis: filled dot #dc2626;
text-emphasis-position: under right;
}
The dots appear below the text.
Using the left Keyword
.example {
writing-mode: horizontal-tb;
text-emphasis: open circle #059669;
text-emphasis-position: over left;
}
The circles still appear above horizontal text because the left and right keywords only affect placement in vertical writing.
Combining Marks With Underlines
.example {
text-decoration: underline;
text-emphasis: filled dot #2563eb;
text-emphasis-position: over right;
}
The underline appears below the text, while the emphasis marks appear above it.
Avoiding Visual Overlap
Marks positioned beneath text can compete with underlines, ruby annotations, or nearby content. Test the final appearance with the actual font and line spacing.
Vertical Text
In vertical writing modes, emphasis marks are positioned to the left or right of the characters.
Marks on the Right
.example {
writing-mode: vertical-rl;
text-emphasis: filled sesame #2563eb;
text-emphasis-position: over right;
}
The marks appear to the right of the vertical text.
Marks on the Left
.example {
writing-mode: vertical-rl;
text-emphasis: filled sesame #dc2626;
text-emphasis-position: over left;
}
The marks appear to the left of the vertical text.
Using under right
.example {
writing-mode: vertical-rl;
text-emphasis: open circle #059669;
text-emphasis-position: under right;
}
The right keyword places the circles on the right side of the vertical text.
Using under left
.example {
writing-mode: vertical-rl;
text-emphasis: filled dot #7c3aed;
text-emphasis-position: under left;
}
The marks appear on the left side of the vertical text.
Important Consideration
The physical left or right placement is controlled by the corresponding keyword. When specifying both keywords, the horizontal and vertical writing positions can be defined together.
Writing Modes
The writing-mode property determines whether text flows horizontally or vertically. It also affects how emphasis mark positions are interpreted.
Horizontal Top-to-Bottom
.horizontal-text {
writing-mode: horizontal-tb;
text-emphasis: filled dot #2563eb;
text-emphasis-position: over right;
}
Marks appear above the text.
Vertical Right-to-Left
.vertical-text {
writing-mode: vertical-rl;
text-emphasis: filled sesame #2563eb;
text-emphasis-position: over right;
}
Marks appear on the right side of the vertical characters.
Vertical Left-to-Right
.vertical-text {
writing-mode: vertical-lr;
text-emphasis: open circle #059669;
text-emphasis-position: over left;
}
Marks appear on the left side of the vertical characters.
Japanese Text Example
<p lang="ja" class="japanese-text">重要な文章</p>
.japanese-text {
writing-mode: vertical-rl;
text-emphasis: filled sesame #dc2626;
text-emphasis-position: over right;
}
This combines vertical Japanese text with sesame-shaped emphasis marks.
Important Consideration
Use writing modes appropriate to the language and content. Changing the writing mode solely to reposition emphasis marks can affect the entire text layout.
Relationship to text-emphasis
The text-emphasis shorthand sets the mark style and color, but it does not include text-emphasis-position.
Using the Shorthand
.example {
text-emphasis: filled dot #2563eb;
}
This creates blue filled dots in the default position.
Setting Position Separately
.example {
text-emphasis: filled dot #2563eb;
text-emphasis-position: under right;
}
The dots appear beneath horizontal text.
Equivalent Longhand Declarations
.example {
text-emphasis-style: filled dot;
text-emphasis-color: #2563eb;
text-emphasis-position: under right;
}
Changing the Shorthand
.example {
text-emphasis-position: under right;
text-emphasis: open circle #059669;
}
The marks change to green outlined circles, but their position remains unchanged.
Incorrect Shorthand Syntax
.example {
text-emphasis: filled dot blue under;
}
The position keyword cannot be included in the shorthand.
Correct Syntax
.example {
text-emphasis: filled dot blue;
text-emphasis-position: under right;
}
Inheritance
The text-emphasis-position property is inherited. Descendant elements normally use their parent's computed position unless another value is specified.
Inherited Position
.parent {
text-emphasis: filled dot #2563eb;
text-emphasis-position: under right;
}
Descendant text can inherit the emphasis marks and their position.
Overriding the Position
.parent {
text-emphasis: filled dot #2563eb;
text-emphasis-position: over right;
}
.parent .child {
text-emphasis-position: under right;
}
The child displays its emphasis marks beneath horizontal text.
Explicit Inheritance
.child {
text-emphasis-position: inherit;
}
Restoring the Initial Value
.child {
text-emphasis-position: initial;
}
This restores over right.
Using unset
.child {
text-emphasis-position: unset;
}
Because the property is inherited, unset uses the parent's computed value.
Important Consideration
The inherited keywords remain the same even when descendants use different writing modes. Their visible placement is interpreted according to each element's writing mode.
Practical Examples
Dots Above Text
.emphasis-above {
text-emphasis: filled dot #2563eb;
text-emphasis-position: over right;
}
Dots Below Text
.emphasis-below {
text-emphasis: filled dot #dc2626;
text-emphasis-position: under right;
}
Open Circles Above Text
.circle-emphasis {
text-emphasis: open circle #059669;
text-emphasis-position: over right;
}
Custom Stars Below Text
.star-emphasis {
text-emphasis: "★" #ca8a04;
text-emphasis-position: under right;
}
Sesame Marks on the Right
.vertical-right {
writing-mode: vertical-rl;
text-emphasis: filled sesame #2563eb;
text-emphasis-position: over right;
}
Sesame Marks on the Left
.vertical-left {
writing-mode: vertical-rl;
text-emphasis: filled sesame #dc2626;
text-emphasis-position: over left;
}
Inherited Emphasis Position
.emphasis-container {
text-emphasis: filled dot #7c3aed;
text-emphasis-position: under right;
}
Resetting the Position
.reset-position {
text-emphasis-position: initial;
}
Removing Emphasis Marks
.no-emphasis {
text-emphasis-style: none;
}
This removes the marks without changing the inherited position.
text-emphasis-position Example
This example compares emphasis marks above and below horizontal text, then demonstrates left and right positioning in vertical writing.
HTML Example
<div class="emphasis-position-demo" lang="ja">
<div class="emphasis-sample">
<strong>Over Right</strong>
<p class="position-over">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Under Right</strong>
<p class="position-under">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Vertical - Right</strong>
<p class="position-vertical-right">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Vertical - Left</strong>
<p class="position-vertical-left">重要な文章</p>
</div>
</div>
CSS Example
.emphasis-position-demo {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
}
.emphasis-position-demo .emphasis-sample {
min-height: 150px;
padding: 18px 16px;
border: 1px solid #cbd5e1;
background: #f8fafc;
}
.emphasis-position-demo strong {
display: block;
margin-bottom: 18px;
color: #334155;
font-size: 14px;
}
.emphasis-position-demo p {
margin: 0;
color: #1f2937;
font-size: 26px;
line-height: 2;
text-emphasis: filled dot #2563eb;
}
.emphasis-position-demo .position-over {
padding-top: 12px;
text-emphasis-position: over right;
}
.emphasis-position-demo .position-under {
text-emphasis-position: under right;
}
.emphasis-position-demo .position-vertical-right {
writing-mode: vertical-rl;
height: 180px;
text-emphasis: filled sesame #059669;
text-emphasis-position: over right;
}
.emphasis-position-demo .position-vertical-left {
writing-mode: vertical-rl;
height: 180px;
text-emphasis: filled sesame #dc2626;
text-emphasis-position: over left;
}
重要な文章
重要な文章
重要な文章
重要な文章
Comparing the Results
| Setting | Expected Appearance |
|---|---|
over right with horizontal text |
Blue dots above the characters. |
under right with horizontal text |
Blue dots below the characters. |
over right with vertical text |
Green sesame marks to the right of the characters. |
over left with vertical text |
Red sesame marks to the left of the characters. |
Changing the Emphasis Shape
.emphasis-position-demo p {
text-emphasis-style: open circle;
}
The marks change to outlined circles while retaining their specified positions.
Changing the Emphasis Color
.emphasis-position-demo p {
text-emphasis-color: #7c3aed;
}
All marks become purple without changing their positions.
Changing Vertical Placement
.emphasis-position-demo .position-vertical-right {
text-emphasis-position: over left;
}
The marks move from the right side to the left side of the vertical text.
Accessibility Considerations
Emphasis mark positioning affects visual presentation and should not be the only method used to communicate important information.
Preserve Readability
Choose positions that keep emphasis marks separate from surrounding text and decorations.
Avoid Overlapping Decorations
Test emphasis marks alongside underlines, ruby annotations, and other text decorations.
Use Appropriate Writing Modes
Follow the typographic conventions of the language being displayed.
Do Not Rely on Position Alone
Screen readers do not reliably communicate emphasis mark positions. Include important meaning in the text itself.
Consider Text Spacing
Verify that emphasis marks remain visible when users increase line spacing or text size.
Test Zoom and Reflow
Check that marks do not become clipped or overlap nearby content at higher zoom levels.
Use Language Attributes
Specify the appropriate HTML lang attribute for multilingual text.
Avoid Unnecessary Decoration
Excessive emphasis marks can make text harder to read, especially in dense layouts.
Common Mistakes
Using top Instead of over
.example {
text-emphasis-position: top;
}
Use over to position marks above horizontal text.
Using bottom Instead of under
.example {
text-emphasis-position: bottom;
}
Use under to position marks below horizontal text.
Using center
.example {
text-emphasis-position: center;
}
The property does not support centered emphasis marks.
Using Length Values
.example {
text-emphasis-position: 10px;
}
Custom offsets are not supported by this property.
Combining Conflicting Keywords
.example {
text-emphasis-position: over under;
}
Choose one of the two keywords.
Combining left and right
.example {
text-emphasis-position: left right;
}
Only one horizontal-side keyword can be specified.
Expecting Position to Create Marks
.example {
text-emphasis-position: under right;
}
This sets the position but does not create emphasis marks.
Correct Example
.example {
text-emphasis: filled dot #2563eb;
text-emphasis-position: under right;
}
Including Position in the Shorthand
.example {
text-emphasis: filled dot red over;
}
Specify the position separately.
Expecting left and right to Affect Horizontal Text
The left and right keywords determine the side used in vertical writing. They do not move marks horizontally around individual characters in horizontal writing.
Ignoring Writing Modes
The same position declaration can produce different visible placements depending on the writing mode.
Important Considerations
Keep the following points in mind when using text-emphasis-position:
- The property controls the placement of text emphasis marks.
- The initial value is
over right. - The property is inherited.
- The
overkeyword places marks above horizontal text. - The
underkeyword places marks below horizontal text. - The
leftandrightkeywords control placement in vertical writing. - The
leftandrightkeywords do not affect placement in horizontal writing. - The property accepts one vertical-side keyword and optionally one horizontal-side keyword.
- Keyword order can be reversed.
- Lengths and arbitrary offsets are not supported.
- The property does not create emphasis marks.
- Use
text-emphasis-styleto select a mark shape. - Use
text-emphasis-colorto control mark color. - The
text-emphasisshorthand does not include position. - Changing the shorthand does not reset the emphasis position.
- The writing mode affects how position keywords are displayed.
- Horizontal text normally uses marks above or below characters.
- Vertical text uses marks to the left or right of characters.
- Position changes do not alter the mark shape or color.
- Position changes are discrete rather than smoothly interpolated.
- Emphasis marks do not normally change line box dimensions.
- Marks may overlap nearby decorations or annotations.
- Use appropriate language attributes and writing modes.
- Test the selected position with actual fonts and text.
- Verify visibility at different text sizes and zoom levels.
- Do not rely on visual emphasis alone to communicate essential meaning.
Browser Support
The CSS text-emphasis-position property is supported in modern browsers, including Chrome, Edge, Firefox, and Safari. Support for individual keyword combinations should be checked when targeting older browser versions.
For current compatibility information, visit Can I Use? and search for text-emphasis-position.
Basic Compatibility
.example {
text-emphasis: filled dot #2563eb;
text-emphasis-position: over right;
}
This places blue emphasis dots above horizontal text.
Feature Detection
@supports (text-emphasis-position: under right) {
.example {
text-emphasis-position: under right;
}
}
This checks whether the browser recognizes the specified position value.
Fallback Example
.example {
font-weight: bold;
}
@supports (text-emphasis: filled dot) and (text-emphasis-position: under right) {
.example {
font-weight: normal;
text-emphasis: filled dot #2563eb;
text-emphasis-position: under right;
}
}
Browsers without support retain bold text, while supporting browsers display blue dots beneath the text.
Testing Recommendations
Test the over, under, left, and right combinations in the writing modes used on the page. Check for clipping and overlapping decorations.
Specifications
The text-emphasis-position property is defined in the CSS Text Decoration Module Level 3 specification.
CSS Text Decoration Module Level 3 - text-emphasis-position Property
The specification defines how emphasis marks are positioned in horizontal and vertical writing modes.
For additional documentation and examples, consult MDN Web Docs.
