white-space-intrinsic-size-015.html (1919B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Text Test: min-content sizing and 'white-space: pre'</title> 6 7 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> 8 <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property"> 9 <link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2"> 10 <link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> 11 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> 12 13 <meta content="When 'white-space' is 'pre', preserved white spaces at the end of the line affect the intrinsic min-content size." name="assert"> 14 15 <style> 16 div 17 { 18 color: transparent; 19 /* 20 so that background-color can 21 shine through the A, G, M, Z glyphs 22 */ 23 font-family: Ahem; 24 font-size: 25px; 25 line-height: 1; 26 width: 0; 27 /* 28 This will trigger 29 min-content size 30 for div#min-sized-parent 31 */ 32 } 33 34 div#reference-overlapped-red 35 { 36 background-color: red; 37 position: absolute; 38 width: auto; 39 z-index: -1; 40 } 41 42 div#test-overlapping-green 43 { 44 background-color: green; 45 float: left; 46 white-space: pre; 47 width: auto; 48 } 49 </style> 50 51 <p>Test passes if there is a filled green square and <strong>no red</strong>. 52 53 <div id="reference-overlapped-red">1234<br>567<br>89<br>0</div> 54 55 <div id="min-sized-parent"> 56 57 <div id="test-overlapping-green">A
G 
 M
 Z </div> 58 59 </div> 60 61 <!-- 62 63 The white spaces preceding or following 64 the "G", "M" and "Z" do not get 65 wrapped. That is by definition of 66 'white-space: pre'. 67 68 The line feeds (
) wrap 69 content to the next line box. 70 71 Since div#test-overlapping-green 72 is floated and since its parent in 73 the flow is 0-width, then the float 74 is min-content sized. 75 76 -->