blob: 5a3da68572ce70b8a97db7f337379ce0a4a7d652 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Grid items with percentage margins</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@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="support/grid.css">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
.container {
width: 100px;
height: 100px;
}
.child {
width: 25px;
height: 25px;
margin: 50px;
background: red;
}
.ref {
position: absolute;
z-index: -1;
background: green;
}
.grid {
background: none;
}
#item {
margin: 50%;
background: 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"></div></div>
<div class="container grid"><div class="child" id="item"></div></div>
<script>
item.style.width = "0px";
item.offsetLeft;
item.style.width = "25px";
item.offsetLeft;
</script>