hanging-whitespace-002.tentative.html (1525B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Text Level 3: pre-wrap conditionality when not at line end</title> 4 <link rel="author" title="Andreu Botella" href="mailto:abotella@igalia.com"> 5 <link rel="help" href="https://drafts.csswg.org/css-text-3/#hanging"> 6 <link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> 7 <link rel="match" href="/css/reference/ref-filled-green-100px-square.xht"> 8 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 9 <meta name="assert" content="Spaces with white-space: pre-wrap always hang unconditionally when followed by other unconditionally hanging glyphs"> 10 11 <style> 12 div { 13 font: 25px/1 Ahem; 14 width: 5ch; 15 height: 4ch; 16 margin-left: -1ch; 17 background: 18 linear-gradient(red, red) 4ch 0 / 1ch 4ch no-repeat, 19 linear-gradient(green, green) 1ch 0 / 3ch 4ch no-repeat; 20 21 white-space: normal; 22 text-align: right; 23 color: green; 24 } 25 .pre-wrap { 26 white-space: pre-wrap; 27 } 28 </style> 29 30 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 31 32 <div><span class="pre-wrap">X </span> <br>X<br>X<br>X</div> 33 34 <!-- 35 With white-space: pre-wrap, spaces hang conditionally when they are followed 36 by a forced line break. If instead they are followed by a glyph that hangs 37 unconditionally, such as the ideographic space (U+3000) with 38 white-space: normal, then they are not followed by a forced line break, even 39 if that hanging glyph might be, and thus hang unconditionally as well. 40 -->