summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-flexbox/percentage-margins-001.html
blob: b98bfa1af875b6961b4819fa0e7f82a24fcf783d (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
<!DOCTYPE html>
<title>CSS Flexbox: percent margins with flex child</title>
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-containers">
<link rel="help" href="https://drafts.csswg.org/css2/box.html#margin-properties">
<link rel="help" href="https://bugs.webkit.org/show_bug.cgi?id=93411">
<meta name="assert" content="This test ensures that percent margins always are computed with respect to the containing block's width even when there is flex on any child.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<body onload="checkLayout('.flexbox')">
<div id=log></div>

<div class="flexbox" style="display:flex; flex-direction: column; background-color: salmon; height: 300px; width: 400px;">
    <div style="margin: 10%; background-color: orange; height: 5px; flex: 1" data-expected-width=320 data-expected-height=135></div>
    <div style="margin: 10%; background-color: orange; height: 5px;" data-expected-width=320 data-expected-height=5></div>
</div>

<div class="flexbox" style="display:flex; background-color: salmon; height: 300px; width: 400px;">
    <div style="margin: 10%; background-color: orange; height: 5px; flex: 1 5px" data-expected-width=235 data-expected-height=5></div>
    <div style="margin: 10%; background-color: orange; height: 5px; width: 5px" data-expected-width=5 data-expected-height=5></div>
</div>

<div class="flexbox" style="display:flex; background-color: salmon; height: 300px; width: 400px; padding: 100px;">
    <div style="margin: 10%; background-color: orange; height: 5px; flex: 1 5px" data-expected-width=235 data-expected-height=5></div>
    <div style="margin: 10%; background-color: orange; height: 5px; width: 5px" data-expected-width=5 data-expected-height=5></div>
</div>

</body>