Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

hyphenate-character — CSS property

`hyphenate-character` controls the glyph painted at a hyphenation break during word hyphenation.

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

Syntax

auto | <string>

hyphenate-character controls the glyph painted at a hyphenation break during word hyphenation.

The example uses a narrow block and a soft hyphen or automatic-hyphenation settings, then reports line height and the computed value.

The accepted grammar is auto | <string>; global values still participate in the cascade.

Automatic hyphenation depends on the language and the browser dictionary; a soft hyphen appears only when a break is taken there.

Examples

<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title>
<body><div class="probe">probe</div><pre id="result"></pre><script>
const x=document.querySelector(".probe");x.innerHTML="extra&shy;ordinary";x.style.cssText="width:55px;font:16px/20px sans-serif;hyphens:manual";x.style.setProperty("hyphenate-character",JSON.stringify("~"));document.querySelector("#result").textContent="lines="+Math.round(x.getBoundingClientRect().height/20)+"; computed="+getComputedStyle(x).hyphenateCharacter;
</script></body></html>

Result

lines=2; computed="~"

The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.

Sources