<!DOCTYPE html> | |
<meta charset="UTF-8"> | |
<title>CSS Text Test: min-content sizing and 'white-space: pre-wrap'</title> | |
<link rel="author" title="GĂ©rard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> | |
<link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-property"> | |
<link rel="help" href="https://www.w3.org/TR/css-text-3/#white-space-phase-2"> | |
<link rel="help" href="https://www.w3.org/TR/css-text-3/#hanging"> | |
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> | |
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> | |
<meta content="" name="flags"> | |
<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"> | |
<style> | |
div | |
{ | |
color: transparent; | |
/* | |
so that background-color can | |
shine through the ABCD, GHIJ, | |
MNOP, WXYZ glyphs | |
*/ | |
font-family: Ahem; | |
font-size: 25px; | |
line-height: 1; | |
width: 0; | |
/* | |
'width: 0' will trigger | |
min-content size | |
for div#min-sized-parent | |
*/ | |
} | |
div.test-overlapped-red | |
{ | |
background-color: red; | |
float: left; | |
white-space: pre-wrap; | |
width: auto; | |
} | |
div#reference-overlapping-green | |
{ | |
background-color: green; | |
position: absolute; | |
width: auto; | |
} | |
</style> | |
<p>Test passes if there is a filled green square and <strong>no red</strong>. | |
<div id="min-sized-parent"> | |
<div class="test-overlapped-red">ABCD </div> | |
<div class="test-overlapped-red">GHIJ </div> | |
<div class="test-overlapped-red">MNOP </div> | |
<div class="test-overlapped-red">WXYZ </div> | |
</div> | |
<!-- | |
The sequences of 4 white spaces following | |
the "ABCD", following the "GHIJ", following | |
the "MNOP" and following the "WXYZ" do not | |
get collapsed due to | |
'white-space: pre-wrap': they hang. Such | |
sequences of 4 hanging-overflowing end-of-line | |
white spaces are not considered with regards | |
to the line box content for fit. | |
Since the 4 div.test-overlapped-red | |
are floated and since its parent in | |
the flow is 0-width, then these 4 floats | |
are min-content sized. | |
--> | |
<div id="reference-overlapping-green">1234<br>5678<br>90AB<br>CDEF</div> |