white-space-intrinsic-size-020.html (2134B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Text Test: min-content sizing and 'white-space: pre-line'</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-line', sequence of white spaces are collapsed into 1 white space, the tabs are converted into a single white space and then the white spaces at the end of the line are removed." 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: 50px; 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-line; /* spaces and tabs collapse */ 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">12<br>3</div> 54 55 <div id="min-sized-parent"> 56 57 <div class="test-overlapping-green"> 	 	 AG </div> 58 59 <div class="test-overlapping-green"> MZ 	 	 </div> 60 61 </div> 62 63 <!-- 64 65 The sequence of white spaces 66 are collapsed. The tabs are 67 converted into a single 68 white space character. Then 69 the spaces at the end-of-line 70 are removed. That 71 is by definition of 72 'white-space: pre-line'. 73 74 The end result is 75 [AG 76 MZ] 77 78 Since div#test-overlapping-green 79 is floated and since its parent in 80 the flow is 0-width, then the float 81 is min-content sized. 82 83 -->