contain-layout-ifc-022.html (1785B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Containment Test: 'contain: layout' and creation of an independent formating context: text no longer flowing around a float</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-layout"> 9 <link rel="match" href="reference/contain-layout-ifc-022-ref.html"> 10 11 <meta content="This test checks that an element with 'contain: layout' will make such element create its own formatting context. In this test, the element with 'contain: layout' acts as if it has its own formatting context independent from div#floated-left element. In other words, the div#with-contain-layout is no longer required to flow its content around the div#floated-left element and current line boxes next to the float are no longer shortened to make room for the margin box of the float." name="assert"> 12 13 <style> 14 div 15 { 16 color: transparent; 17 font-size: 16px; 18 padding: 8px; 19 } 20 21 div#floated-left 22 { 23 background-color: blue; 24 float: left; 25 margin: 8px; 26 width: 6em; 27 } 28 29 div#with-contain-layout 30 { 31 background-color: orange; 32 contain: layout; 33 width: 12em; 34 } 35 </style> 36 37 <p>Test passes if the orange rectangle and blue rectangle do not overlap. 38 39 <!-- 40 41 or 42 43 <p>Test passes if the orange rectangle and blue rectangle are side by side. 44 45 or 46 47 <p>Test passes if the orange rectangle and blue rectangle are apart from each other. 48 49 --> 50 51 <div id="floated-left">Some text in a blue rectangle.</div> 52 53 <div id="with-contain-layout">Some text in an orange rectangle. Some text in an orange rectangle. Some text in an orange rectangle.</div>