summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/grid-items/grid-items-percentage-margins-011.html
blob: f2a87e1fb81c2b765bf6d6d62307b8045fa07af5 (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
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Grid items with percentage margins</title>
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#item-margins">
<meta name="assert" content="Checks grid items percentage margins are resolved correctly in a 'auto' sized grid area after changing the item's width and forcing a new layout.">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<link rel="stylesheet" href="/css/support/grid.css">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
.container {
    font: 25px/1 Ahem;
    width: 100px;
}
.child {
    margin: 50px 0px;
    color: red;
}
.ref {
    position: absolute;
    z-index: -1;
    background: green;
    height: 100px;
}
.grid {
    background: none;
}
#item {
    margin: 50% 0px;
    color: green;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div class="container ref"><div class="child">X</div></div>
<div class="container grid"><div class="child" id="item">X</div></div>
<script>
    item.offsetLeft;
    item.style.width = "0px";
    item.offsetLeft;
    item.style.width = "auto";
</script>