CSS text-emphasis-color Property
The CSS text-emphasis-color property specifies the color of emphasis marks displayed alongside individual text characters.
Emphasis marks are commonly used in East Asian typography to highlight words or phrases. This property changes their color without changing the text color, mark shape, or position.
Use text-emphasis-style to create the marks and text-emphasis-position to control their placement. The text-emphasis shorthand can set the style and color together.
text-emphasis-color Syntax
The property accepts any valid CSS <color> value.
Basic Syntax
.example {
text-emphasis-color: red;
}
Available Values
.example {
text-emphasis-color: currentColor;
}
.example {
text-emphasis-color: blue;
}
.example {
text-emphasis-color: #2563eb;
}
.example {
text-emphasis-color: rgb(37 99 235);
}
.example {
text-emphasis-color: hsl(221 83% 53%);
}
.example {
text-emphasis-color: transparent;
}
CSS-Wide Keywords
.example {
text-emphasis-color: initial;
}
.example {
text-emphasis-color: inherit;
}
.example {
text-emphasis-color: unset;
}
.example {
text-emphasis-color: revert;
}
.example {
text-emphasis-color: revert-layer;
}
The initial value is currentColor. Because the property is inherited, unset behaves like inherit.
Valid Examples
.example {
text-emphasis-color: #dc2626;
}
.example {
text-emphasis-color: rgb(5 150 105 / 80%);
}
.example {
text-emphasis-color: hsl(270 70% 50%);
}
.example {
text-emphasis-color: var(--emphasis-color);
}
Invalid Examples
.example {
text-emphasis-color: bold;
}
.example {
text-emphasis-color: filled dot;
}
.example {
text-emphasis-color: 3px;
}
.example {
text-emphasis-color: red blue;
}
Font weights, emphasis shapes, lengths, and multiple color values are invalid for this longhand property.
Property Values
| Value | Description |
|---|---|
currentColor |
Uses the element's current text color for emphasis marks. |
<color> |
Specifies a CSS color using a named color, hexadecimal notation, color function, or another valid color value. |
transparent |
Uses a fully transparent color, making the marks invisible. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | currentColor |
| Inherited | Yes |
| Applies to | All elements |
| Computed value | Computed color |
| Animation type | By computed value type (color) |
| Percentages | Not applicable directly; color functions may contain percentages |
| Shorthand | text-emphasis |
| Specification | CSS Text Decoration Module Level 3 |
Note: The property only changes the color of emphasis marks. It does not create marks or change their shape.
How It Works
The browser uses text-emphasis-color when painting emphasis marks established by text-emphasis-style.
Step 1: Create Emphasis Marks
.example {
text-emphasis-style: filled dot;
}
The browser draws filled dots using the current text color.
Step 2: Specify a Color
.example {
text-emphasis-style: filled dot;
text-emphasis-color: #2563eb;
}
The emphasis dots become blue.
Step 3: Change the Text Color
.example {
color: #1f2937;
text-emphasis-style: filled dot;
text-emphasis-color: #2563eb;
}
The text remains dark gray while the marks stay blue.
Step 4: Change the Mark Shape
.example {
text-emphasis-style: open circle;
text-emphasis-color: #2563eb;
}
The browser draws blue outlined circles instead of filled dots.
Step 5: Change the Mark Position
.example {
text-emphasis-style: filled dot;
text-emphasis-color: #2563eb;
text-emphasis-position: under right;
}
The marks appear below horizontal text while retaining their color.
Important Consideration
When text-emphasis-style is none, changing text-emphasis-color produces no visible result.
CSS Color Values
The property supports the same CSS color syntax used by properties such as color and background-color.
Named Colors
.example {
text-emphasis-style: filled dot;
text-emphasis-color: red;
}
Hexadecimal Colors
.example {
text-emphasis-style: filled circle;
text-emphasis-color: #2563eb;
}
RGB Colors
.example {
text-emphasis-style: open circle;
text-emphasis-color: rgb(5 150 105);
}
RGB With Transparency
.example {
text-emphasis-style: filled dot;
text-emphasis-color: rgb(220 38 38 / 60%);
}
The emphasis marks are drawn with 60% opacity.
HSL Colors
.example {
text-emphasis-style: filled triangle;
text-emphasis-color: hsl(270 70% 50%);
}
HWB Colors
.example {
text-emphasis-style: filled dot;
text-emphasis-color: hwb(220 15% 10%);
}
Transparent Color
.example {
text-emphasis-style: filled dot;
text-emphasis-color: transparent;
}
The emphasis marks become invisible, although their style remains specified.
CSS Custom Properties
:root {
--emphasis-color: #7c3aed;
}
.example {
text-emphasis-style: filled dot;
text-emphasis-color: var(--emphasis-color);
}
Custom properties make it easier to maintain consistent emphasis colors across multiple elements.
Using currentColor
The currentColor keyword uses the element's current text color. It is the initial value of text-emphasis-color.
Basic Example
.example {
color: #2563eb;
text-emphasis-style: filled dot;
text-emphasis-color: currentColor;
}
Both the text and emphasis marks appear blue.
Changing the Text Color
.example {
color: #059669;
text-emphasis-style: filled dot;
text-emphasis-color: currentColor;
}
The marks follow the green text color.
Inherited Text Color
.container {
color: #7c3aed;
}
.container .example {
text-emphasis-style: filled dot;
text-emphasis-color: currentColor;
}
The marks use the inherited purple text color.
Hover Color Changes
.example {
color: #2563eb;
text-emphasis-style: filled dot;
text-emphasis-color: currentColor;
}
.example:hover {
color: #dc2626;
}
The text and emphasis marks change to red on hover.
When currentColor Is Useful
Use currentColor when emphasis marks should automatically match text colors, including inherited colors and state changes.
Text and Emphasis Mark Colors
Text color and emphasis mark color can be controlled independently.
Matching Colors
.example {
color: #2563eb;
text-emphasis-style: filled dot;
text-emphasis-color: currentColor;
}
Different Colors
.example {
color: #1f2937;
text-emphasis-style: filled dot;
text-emphasis-color: #dc2626;
}
The text is dark gray, while the emphasis marks are red.
Color Changes on Hover
.example {
color: #1f2937;
text-emphasis-style: filled dot;
text-emphasis-color: #2563eb;
}
.example:hover {
text-emphasis-color: #dc2626;
}
Only the emphasis marks change color on hover.
Color Transition
.example {
text-emphasis-style: filled dot;
text-emphasis-color: #2563eb;
transition: text-emphasis-color 0.3s ease;
}
.example:hover {
text-emphasis-color: #dc2626;
}
The browser interpolates between the two emphasis colors during the transition.
Important Consideration
Text emphasis color is separate from text-decoration-color. Changing one does not change the other.
Using the text-emphasis Shorthand
The text-emphasis shorthand combines emphasis style and color into one declaration.
Longhand Declarations
.example {
text-emphasis-style: filled dot;
text-emphasis-color: #2563eb;
}
Equivalent Shorthand
.example {
text-emphasis: filled dot #2563eb;
}
Named Color
.example {
text-emphasis: open circle green;
}
Custom Mark and Color
.example {
text-emphasis: "★" #ca8a04;
}
Shorthand Reset Behavior
.example {
text-emphasis-color: #dc2626;
text-emphasis: filled dot;
}
The shorthand resets the emphasis color to currentColor.
Preserving a Custom Color
.example {
text-emphasis: filled dot;
text-emphasis-color: #dc2626;
}
The later longhand declaration applies the red color.
Color-Only Shorthand
.example {
text-emphasis: #2563eb;
}
This is valid, but the emphasis style is reset to none, so no marks appear.
Important Consideration
The shorthand does not include text-emphasis-position. Positioning must be controlled separately.
Inheritance
The text-emphasis-color property is inherited. Descendant elements normally receive the computed emphasis color of their parent unless they specify another value.
Inherited Color
.parent {
text-emphasis-style: filled dot;
text-emphasis-color: #2563eb;
}
Descendants can inherit both the emphasis style and color.
Overriding an Inherited Color
.parent {
text-emphasis: filled dot #2563eb;
}
.parent .child {
text-emphasis-color: #dc2626;
}
The child uses red emphasis marks instead of blue.
Explicit Inheritance
.child {
text-emphasis-color: inherit;
}
The child uses its parent's computed emphasis color.
Restoring the Initial Value
.child {
text-emphasis-color: initial;
}
This restores currentColor.
Removing Inherited Emphasis Marks
.child {
text-emphasis-style: none;
}
This removes the marks from the child without requiring a change to its emphasis color.
Important Consideration
An explicitly inherited color is the parent's computed color. If marks should follow each child's own text color, use currentColor on the child.
Practical Examples
Red Emphasis Dots
.important-text {
text-emphasis-style: filled dot;
text-emphasis-color: #dc2626;
}
Displays red emphasis dots alongside eligible characters.
Green Open Circles
.highlighted-text {
text-emphasis-style: open circle;
text-emphasis-color: #059669;
}
Creates outlined green emphasis marks.
Purple Double-Circles
.special-text {
text-emphasis-style: filled double-circle;
text-emphasis-color: #7c3aed;
}
Orange Sesame Marks
.japanese-text {
text-emphasis-style: filled sesame;
text-emphasis-color: #ea580c;
}
Gold Custom Stars
.featured-text {
text-emphasis-style: "★";
text-emphasis-color: #ca8a04;
}
Matching Text and Marks
.matching-text {
color: #2563eb;
text-emphasis-style: filled dot;
text-emphasis-color: currentColor;
}
Semi-Transparent Marks
.subtle-emphasis {
text-emphasis-style: filled circle;
text-emphasis-color: rgb(37 99 235 / 65%);
}
Emphasis Below Text
.under-emphasis {
text-emphasis-style: filled dot;
text-emphasis-color: #7c3aed;
text-emphasis-position: under right;
}
Vertical Writing
.vertical-emphasis {
writing-mode: vertical-rl;
text-emphasis-style: filled sesame;
text-emphasis-color: #2563eb;
text-emphasis-position: over right;
}
Theme Color Variable
:root {
--accent-color: #2563eb;
}
.themed-emphasis {
text-emphasis-style: filled dot;
text-emphasis-color: var(--accent-color);
}
text-emphasis-color Example
This example compares different emphasis mark colors while keeping the same filled dot shape. Japanese text is used to make the individual character marks easier to see.
HTML Example
<div class="emphasis-color-demo" lang="ja">
<div class="emphasis-sample">
<strong>Red</strong>
<p class="emphasis-red">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Blue</strong>
<p class="emphasis-blue">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Green</strong>
<p class="emphasis-green">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Purple</strong>
<p class="emphasis-purple">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>Orange</strong>
<p class="emphasis-orange">重要な文章</p>
</div>
<div class="emphasis-sample">
<strong>currentColor</strong>
<p class="emphasis-current">重要な文章</p>
</div>
</div>
CSS Example
.emphasis-color-demo {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
}
.emphasis-color-demo .emphasis-sample {
padding: 18px 16px;
border: 1px solid #cbd5e1;
background: #f8fafc;
}
.emphasis-color-demo strong {
display: block;
margin-bottom: 18px;
color: #334155;
font-size: 14px;
}
.emphasis-color-demo p {
margin: 0;
padding-top: 10px;
color: #1f2937;
font-size: 26px;
line-height: 2;
text-emphasis-style: filled dot;
text-emphasis-position: over right;
}
.emphasis-color-demo .emphasis-red {
text-emphasis-color: #dc2626;
}
.emphasis-color-demo .emphasis-blue {
text-emphasis-color: #2563eb;
}
.emphasis-color-demo .emphasis-green {
text-emphasis-color: #059669;
}
.emphasis-color-demo .emphasis-purple {
text-emphasis-color: #7c3aed;
}
.emphasis-color-demo .emphasis-orange {
text-emphasis-color: #ea580c;
}
.emphasis-color-demo .emphasis-current {
text-emphasis-color: currentColor;
}
重要な文章
重要な文章
重要な文章
重要な文章
重要な文章
重要な文章
Comparing the Results
| Value | Expected Result |
|---|---|
#dc2626 |
Red emphasis dots. |
#2563eb |
Blue emphasis dots. |
#059669 |
Green emphasis dots. |
#7c3aed |
Purple emphasis dots. |
#ea580c |
Orange emphasis dots. |
currentColor |
Emphasis dots matching the text color. |
Changing the Mark Shape
.emphasis-color-demo p {
text-emphasis-style: open circle;
}
All marks become outlined circles while retaining their specified colors.
Changing the Mark Position
.emphasis-color-demo p {
text-emphasis-position: under right;
}
The marks move beneath the horizontal text.
Changing the Text Color
.emphasis-color-demo p {
color: #475569;
}
Only the currentColor sample changes its mark color to match the updated text color.
Accessibility Considerations
Emphasis mark colors can improve visual distinction, but color alone should not communicate essential information.
Maintain Sufficient Contrast
Choose colors that remain visible against the background, especially when marks are small.
Avoid Color-Only Meaning
Use clear wording or additional visual indicators when emphasis communicates important information.
Consider Color Vision Differences
Do not rely on differences between similar colors to distinguish important states.
Avoid Excessive Transparency
Low-opacity emphasis marks may become difficult to see.
Preserve Readability
Use colors that complement the text without creating distracting visual clutter.
Support High Contrast Modes
Test emphasis marks in forced-colors and high-contrast environments, where author-defined colors may be adjusted.
Use Semantic HTML
Text emphasis colors do not provide semantic meaning. Use appropriate HTML elements and clear text when meaning matters.
Test Different Writing Modes
Verify that colored marks remain visible above, below, or beside text in the writing modes used by the page.
Common Mistakes
Expecting Color to Create Emphasis Marks
.example {
text-emphasis-color: red;
}
This changes the color property but does not create marks.
Correct Example
.example {
text-emphasis-style: filled dot;
text-emphasis-color: red;
}
Using Emphasis Style Keywords as Colors
.example {
text-emphasis-color: filled dot;
}
Use text-emphasis-style for the mark shape.
Using Length Values
.example {
text-emphasis-color: 3px;
}
Lengths are not valid color values.
Using Multiple Colors
.example {
text-emphasis-color: red blue;
}
The property accepts one color value.
Confusing Text Color With Emphasis Color
.example {
color: red;
}
This changes the text color and affects marks that use currentColor, but it does not override a separately specified emphasis color.
Confusing Emphasis Color With Decoration Color
.example {
text-decoration-color: red;
}
This changes underline, overline, or strikethrough color, not emphasis mark color.
Forgetting Shorthand Reset Behavior
.example {
text-emphasis-color: red;
text-emphasis: filled dot;
}
The shorthand resets the color to currentColor.
Using Transparent Marks Accidentally
.example {
text-emphasis-style: filled dot;
text-emphasis-color: transparent;
}
The marks are present but invisible.
Assuming currentColor Is a Fixed Color
The currentColor keyword follows the element's text color and can change when that color changes.
Expecting Color to Change Mark Position
Use text-emphasis-position to control placement.
Important Considerations
Keep the following points in mind when using text-emphasis-color:
- The property controls the color of text emphasis marks.
- The initial value is
currentColor. - The property is inherited.
- It accepts valid CSS color values.
- Named colors, hexadecimal values, and color functions are supported.
- The
currentColorkeyword uses the element's text color. - Explicit colors allow marks to differ from the text color.
- Transparent colors can make marks invisible.
- The property does not create emphasis marks.
- Use
text-emphasis-styleto establish a mark shape. - Use
text-emphasis-positionto control placement. - The property is part of the
text-emphasisshorthand. - The shorthand resets color when no color is supplied.
- Color changes do not affect the mark shape.
- Color changes do not affect the mark position.
- The property is separate from
text-decoration-color. - CSS custom properties can provide reusable emphasis colors.
- Emphasis colors can be animated or transitioned.
- Inherited emphasis colors can be overridden by descendants.
- Use
currentColorwhen marks should follow text color changes. - Marks are not normally displayed over spaces or certain punctuation.
- Browser and font differences can affect the appearance of marks.
- Test colors against the page background.
- Avoid using color alone to communicate essential meaning.
- Verify rendering in horizontal and vertical writing modes.
Browser Support
The CSS text-emphasis-color property is widely available in modern browsers, including Chrome, Edge, Firefox, and Safari.
Current major browsers support standard CSS color values for emphasis marks. Rendering may vary depending on the selected mark style, font, and writing mode.
For current compatibility information, visit Can I Use? and search for text-emphasis-color.
Basic Compatibility
.example {
text-emphasis-style: filled dot;
text-emphasis-color: #2563eb;
}
Colored emphasis marks are supported in current major browsers.
Feature Detection
@supports (text-emphasis-color: red) {
.example {
text-emphasis-style: filled dot;
text-emphasis-color: red;
}
}
This checks whether the browser recognizes the color property.
Fallback Example
.example {
font-weight: bold;
}
@supports (text-emphasis: filled dot red) {
.example {
font-weight: normal;
text-emphasis: filled dot red;
}
}
Browsers without text emphasis support retain bold text, while supporting browsers display red emphasis marks.
Testing Recommendations
Test named colors, color functions, and currentColor with the fonts and writing modes used on the page.
Specifications
The text-emphasis-color property is defined in the CSS Text Decoration Module Level 3 specification.
CSS Text Decoration Module Level 3 - text-emphasis-color Property
The specification defines how emphasis mark colors are selected and applied independently of text color and emphasis style.
For additional documentation and examples, consult MDN Web Docs.
