CKTIS / CSS
CSS-Eigenschaft `overflow-wrap`
`overflow-wrap` erlaubt Notumbrüche in einem ungetrennten Wort, damit es nicht überläuft.
Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Syntax
normal | break-word | anywhereoverflow-wrap erlaubt Notumbrüche in einem ungetrennten Wort, damit es nicht überläuft.
Das Beispiel vergleicht die Höhe eines schmalen Blocks für normal und anywhere und zeigt so die Zeilenzahl.
Grammatik: normal | break-word | anywhere. Rad- und Berührungstests am Zielgerät bleiben nötig.
anywhere beeinflusst auch die intrinsische Mindestgröße; break-word behält das ältere min-content-Verhalten.
Beispiele
<!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>Ergebnis
height=20->120; computed=anywhere
Das Beispiel lief lokal in einer isolierten Chrome-Sitzung ohne Netzwerk; das Ergebnis stammt aus der CSS-API des Browsers.