word-break-min-content-001.html (1455B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Text Test: word-break: break-word and intrinsic sizing</title> 4 <link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/"> 5 <link rel="help" href="https://drafts.csswg.org/css-text-3/#word-break-property"> 6 <link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word"> 7 <link rel="match" href="../overflow-wrap/reference/overflow-wrap-min-content-size-001-ref.html"> 8 <meta name="assert" content="word-break: break-word should behave as overflow-wrap: anywhere, so breaking opportunities **are** considered when calculating min-content intrinsic sizes."> 9 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> 10 <style> 11 div { font: 20px/1 Ahem; } 12 table { 13 font: 20px/1 Ahem; 14 word-break: break-word; 15 max-width: 0; 16 border: 0; 17 border-collapse: collapse; 18 } 19 td { 20 padding: 0; 21 background: green; 22 color: transparent; 23 } 24 #red { 25 position: absolute; 26 z-index: -1; 27 background: red; 28 color: transparent; 29 } 30 </style> 31 32 <p>Test passes if there is a green box below and no red. 33 <div id=red>X<br>X<br>X<br>X</div> 34 <table><tr><td>XXXX</table> 35 36 <!-- 37 width:min-content on the div directly without using a table 38 would achieve the goal of this test, and be a lot simpler. 39 40 However, width:min-content is not yet widely supported. 41 42 Using a table, and forcing it to be as small as possible 43 will achieve min-content sizing of the div in all browsers. 44 -->