Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

CSS property `overflow-wrap`

`overflow-wrap` permits emergency breaks inside an unbroken word so it does not overflow the line box.

Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review

Syntax

normal | break-word | anywhere

overflow-wrap permits emergency breaks inside an unbroken word so it does not overflow the line box.

The example compares a narrow block under normal and anywhere, so its height exposes the resulting line count.

Grammar: normal | break-word | anywhere. This example does not replace wheel and touch testing on the target device.

anywhere also participates in intrinsic minimum sizing, while break-word retains legacy min-content behavior.

Examples

<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title><body><pre id="result"></pre><script>
const x=document.createElement("div");document.body.prepend(x);x.textContent="ABCDEFGHIJKLMN";x.style.cssText="width:32px;font:16px/20px sans-serif;overflow-wrap:normal";const a=x.getBoundingClientRect().height;x.style.overflowWrap="anywhere";const b=x.getBoundingClientRect().height;document.querySelector("#result").textContent="height="+Math.round(a)+"->"+Math.round(b)+"; computed="+getComputedStyle(x).overflowWrap;
</script></body></html>

Result

height=20->120; computed=anywhere

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

Sources