contain-size-027.html (2239B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Containment Test: 'contain: size' applies to inline-block</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-contain-1/#containment-size"> 9 <link rel="match" href="reference/contain-size-027-ref.html"> 10 11 <meta content="This test checks that when laying out an inline-block element with 'contain: size', the inline-block element must be treated as if it would have no contents. In this test, the inline-block element has 2 in-flow block descendants made of text." name="assert"> 12 13 <!-- 14 15 contain-size-021: inline-block with 1 image and no in-flow block descendant: width comparison 16 17 contain-size-022: inline-block with 1 image and no in-flow block descendant: height comparison 18 19 contain-size-023: inline-block with text and no in-flow block descendant: width comparison 20 21 contain-size-024: inline-block with text and no in-flow block descendant: height comparison 22 23 contain-size-025: inline-block and 2 in-flow block descendants made of images: width comparison 24 25 contain-size-026: inline-block and 2 in-flow block descendants made of images: height comparison 26 27 contain-size-027: inline-block and 2 in-flow block descendants made of text: width comparison 28 29 contain-size-028: inline-block and 2 in-flow block descendants made of text: height comparison 30 31 --> 32 33 <style> 34 div.inline-block 35 { 36 display: inline-block; 37 } 38 39 div#blue-test 40 { 41 background-color: blue; 42 color: transparent; 43 contain: size; 44 font-size: 50px; 45 line-height: 1; 46 padding: 50px; 47 } 48 49 span.block-descendant 50 { 51 display: block; 52 } 53 54 div#orange-reference 55 { 56 background-color: orange; 57 height: 100px; 58 width: 100px; 59 } 60 </style> 61 62 <p>This test passes if the painted blue area is <strong>exactly as wide as</strong> the orange square. 63 64 <div> 65 <div id="blue-test" class="inline-block"> 66 <span class="block-descendant">B</span> 67 <span id="last-line-box" class="block-descendant">L</span> 68 </div> 69 </div> 70 71 <div> 72 <div id="orange-reference" class="inline-block"></div> 73 </div>