Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<meta name="assert" content="Changing the grid's justify-items value from 'stretch' to 'center' updates both the width and the position of non-replaced grid items.">
<style>
.grid {
position: relative;
display: grid;
grid-template-rows: 100px 100px;
grid-template-columns: 150px;
width: 150px;
justify-items: stretch;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<script src="support/style-change.js"></script>
<script>
setup({ explicit_done: true });
function runTest() {
evaluateStyleChangeMultiple("before", {
item1: { "data-expected-width": 150, "data-offset-x": 0 },
item2: { "data-expected-width": 150, "data-offset-x": 0 }
});
grid.style.justifyItems = "center";
evaluateStyleChangeMultiple("after", {
item1: { "data-expected-width": 50, "data-offset-x": 50 },
item2: { "data-expected-width": 100, "data-offset-x": 25 }
});
done();
}
</script>
<body onload="runTest()">
<div class="grid" id="grid">
<div id="item1" style="height: 50px; grid-area: 1 / 1;">
<div style="width: 50px;"></div>
</div>
<div id="item2" style="height: 50px; grid-area: 2 / 1;">
<div style="width: 100px;"></div>
</div>
</div>
</body>