white-space-intrinsic-size-014.html (2468B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Text Test: min-content sizing and 'white-space: pre-wrap'</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="help" href="https://www.w3.org/TR/css-text-3/#hanging"> 11 <link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> 12 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> 13 14 <meta content="When 'white-space' is 'pre-wrap', white spaces at the end of the line are preserved. In this test, the 4 overflowing white spaces following the 'ABCD', following the 'GHIJ', following the 'MNOP' and following the 'WXYZ' conditionally 'hang' while they do not affect the intrinsic min-content size." name="assert"> 15 16 <style> 17 div 18 { 19 color: transparent; 20 /* 21 so that background-color can 22 shine through the ABCD, GHIJ, 23 MNOP, WXYZ glyphs 24 */ 25 font-family: Ahem; 26 font-size: 25px; 27 line-height: 1; 28 width: 0; 29 /* 30 'width: 0' will trigger 31 min-content size 32 for div#min-sized-parent 33 */ 34 } 35 36 div.test-overlapped-red 37 { 38 background-color: red; 39 float: left; 40 white-space: pre-wrap; 41 width: auto; 42 } 43 44 div#reference-overlapping-green 45 { 46 background-color: green; 47 position: absolute; 48 width: auto; 49 } 50 </style> 51 52 <p>Test passes if there is a filled green square and <strong>no red</strong>. 53 54 <div id="min-sized-parent"> 55 56 <div class="test-overlapped-red">ABCD </div> 57 58 <div class="test-overlapped-red">GHIJ </div> 59 60 <div class="test-overlapped-red">MNOP </div> 61 62 <div class="test-overlapped-red">WXYZ </div> 63 64 </div> 65 66 <!-- 67 68 The sequences of 4 white spaces following 69 the "ABCD", following the "GHIJ", following 70 the "MNOP" and following the "WXYZ" do not 71 get collapsed due to 72 'white-space: pre-wrap': they hang. Such 73 sequences of 4 hanging-overflowing end-of-line 74 white spaces are not considered with regards 75 to the line box content for fit. 76 77 Since the 4 div.test-overlapped-red 78 are floated and since its parent in 79 the flow is 0-width, then these 4 floats 80 are min-content sized. 81 82 --> 83 84 <div id="reference-overlapping-green">1234<br>5678<br>90AB<br>CDEF</div>