summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-flexbox/overflow-auto-003.html
blob: 29063b79d52f49e0041683be950cc513a6f020e7 (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
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<title>CSS Flexbox: margin: auto and overflow: auto with nested flexboxes.</title>
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#auto-margins">
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#overflow-properties">
<link rel="help" href="https://drafts.csswg.org/css-box-3/#margins">
<link rel="help" href="https://crbug.com/605682">
<meta name="assert" content="This test checks that 'margin: auto' set on the outer box gets properly handled when the inner box uses 'overflow: auto', in a layout with two nested flexboxes." />

<style>
html, body {
  margin: 0;
  padding: 0;
}

.flexbox {
  display: flex;
  background: papayawhip;
  width: 800px;
}

.flexbox > div {
  width: 300px;
  height: 300px;
  margin: 0 auto;
  background: olive;
}

.flexbox > div > div {
  overflow-y: auto;
  height: 50px;
  visibility: hidden;
}

.elm {
  height: 10px;
}
</style>

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>

<body>

<div id=log></div>
<p>Below there should be a olive square <em>centered</em> inside a papayawhip box.</p>
<div class="flexbox">
    <div data-offset-x="250">
        <div>
            <div id="elm"></div>
        </div>
    </div>
</div>

<script>
document.body.offsetTop;
document.getElementById("elm").style.height = "800px";
checkLayout('.flexbox');
</script>
</body>
</html>