line-breaking-011.html (1088B)
1 <!doctype html> 2 <html> 3 <meta charset="utf-8"> 4 <title>CSS Text — line breaking at element boundary 3</title> 5 <meta name=assert content="For soft wrap opportunities defined by the boundary between two characters, the white-space property on nearest common ancestor of the two characters controls breaking."> 6 <link rel=help href="https://www.w3.org/TR/css-text-3/#line-break-details"> 7 <link rel=match href="reference/line-breaking-001-ref.html"> 8 <link rel=author title="Florian Rivoal" href="http://florian.rivoal.net"> 9 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 10 <style> 11 div { 12 color:green; 13 width: 1em; 14 line-height: 1em; 15 font-family: Ahem; 16 white-space: normal; 17 font-size: 20px; 18 } 19 span { 20 white-space: pre; 21 } 22 .container { 23 position: relative; 24 } 25 .fail { 26 color: red; 27 position: absolute; 28 left: 0; 29 top: 1em; 30 z-index: -1; 31 } 32 </style> 33 <body> 34 <p>There should be a green rectangle and no red.</p> 35 <div class=container> 36 <div>X​<span>X<span></div> 37 <div class=fail>X</div> 38 </div> 39 </body> 40 </html>