Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

text-emphasis-position — emphasis mark placement

The text-emphasis-position property selects which side of text receives emphasis marks. It specifies separate positions for horizontal and vertical typographic modes; it does not enable marks by itself.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

text-emphasis-position: [ over | under ] && [ right | left ]?;

text-emphasis-position controls the placement of emphasis marks used, for example, in East Asian typography. To make marks visible, also set text-emphasis-style or the text-emphasis shorthand, since the initial style is none.

One of over and under is required: in horizontal typographic modes, these place marks above or below the text, respectively. Optional right or left selects the side in vertical modes. Omitting this part means right; left alone is invalid. The two parts can appear in either order.

The initial value is over right. The property is inherited, and the text-emphasis shorthand does not reset it. Animation is discrete, without smoothly moving the marks.

The example applies under left to both paragraphs: the horizontal paragraph demonstrates under, while the vertical paragraph demonstrates left. This is not an underline from text-decoration. Placement may be adjusted to avoid conflicts with underline or overline decorations.

Examples

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Text emphasis position</title>
<style>
  .sample {
    font: 32px/2 sans-serif;
    text-emphasis-style: filled circle;
    text-emphasis-position: under left;
  }
  #horizontal { writing-mode: horizontal-tb; }
  #vertical { writing-mode: vertical-rl; }
</style>
</head>
<body>
<h2>Horizontal text</h2>
<p id="horizontal" class="sample" lang="ja">日本語</p>
<h2>Vertical text</h2>
<p id="vertical" class="sample" lang="ja">日本語</p>
<script>
  for (const id of ['horizontal', 'vertical']) {
    const style = getComputedStyle(document.getElementById(id));
    const positions = style.textEmphasisPosition.split(/\s+/);
    const horizontal = style.writingMode === 'horizontal-tb';
    const keyword = positions.find(value => horizontal ? /^(over|under)$/.test(value) : /^(left|right)$/.test(value));
    const side = { over: 'above', under: 'below', left: 'to the left', right: 'to the right' }[keyword];
    console.log(`${style.writingMode}: ${style.textEmphasisStyle !== 'none' && side ? `marks ${side}` : 'no placement verified'} (text-emphasis-position: ${style.textEmphasisPosition})`);
  }
</script>
</body>
</html>

Result

horizontal-tb: marks below (text-emphasis-position: under left)
vertical-rl: marks to the left (text-emphasis-position: under left)

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources