summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-contain/contain-layout-ifc-022.html
blob: 1b66fe347e1f58b3f21979fbd44f873955c2e5a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>

  <meta charset="UTF-8">

  <title>CSS Containment Test: 'contain: layout' and creation of an independent formating context: text no longer flowing around a float</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-contain-1/#containment-layout">
  <link rel="match" href="reference/contain-layout-ifc-022-ref.html">

  <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">

  <style>
  div
    {
      color: transparent;
      font-size: 16px;
      padding: 8px;
    }

  div#floated-left
    {
      background-color: blue;
      float: left;
      margin: 8px;
      width: 6em;
    }

  div#with-contain-layout
    {
      background-color: orange;
      contain: layout;
      width: 12em;
    }
  </style>

  <p>Test passes if the orange rectangle and blue rectangle do not overlap.

  <!--

  or

  <p>Test passes if the orange rectangle and blue rectangle are side by side.

  or

  <p>Test passes if the orange rectangle and blue rectangle are apart from each other.

  -->

  <div id="floated-left">Some text in a blue rectangle.</div>

  <div id="with-contain-layout">Some text in an orange rectangle. Some text in an orange rectangle. Some text in an orange rectangle.</div>