Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

hyphens — CSS property

`hyphens` controls whether and where words may be hyphenated during word hyphenation.

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

Syntax

none | manual | auto

hyphens controls whether and where words may be hyphenated 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 none | manual | auto; 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:none";const a=x.getBoundingClientRect().height;x.style.hyphens="manual";const b=x.getBoundingClientRect().height;document.querySelector("#result").textContent="height="+Math.round(a)+"->"+Math.round(b)+"; computed="+getComputedStyle(x).hyphens;
</script></body></html>

Result

height=20->40; computed=manual

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

Sources