CKTIS / CSS
text-wrap — controlling text wrapping
text-wrap combines enabling text wrapping with choosing how the browser distributes line breaks.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
text-wrap: <'text-wrap-mode'> || <'text-wrap-style'>;text-wrap is shorthand for inherited text-wrap-mode and text-wrap-style. The || operator allows either component or both, in either order. Omitted components reset to their initial values: wrap and auto.
wrap permits wrapping; nowrap allows only forced breaks and can cause overflow. Style selects among existing break opportunities: auto leaves selection to the browser, balance evens out lines, stable limits reflow of earlier lines during editing, and pretty favors quality over speed. Draft avoid-short-last-line discourages an excessively short final line.
text-wrap: balance means wrap balance, not just setting the style. Exact layout depends on the browser. The working draft does not establish Chromium 152 support; local verification is required.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>text-wrap comparison</title>
<style>
p {
width: 8ch;
font: 20px/1.5 monospace;
border: 1px solid;
}
.wrap { text-wrap: wrap; }
.nowrap { text-wrap: nowrap; }
</style>
<p class="wrap">AAAA BBBB</p>
<p class="nowrap">AAAA BBBB</p>
</html>Result
.wrap: AAAA BBBB .nowrap: AAAA BBBB
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.