Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-grid/alignment/grid-alignment-implies-size-change-042.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="assert" content="Changing the grid items' own align-self value from 'stretch' to 'center' updates both the height and the position of non-replaced grid items.">
<style>
.grid {
position: relative;
display: grid;
grid-template-rows: 150px;
grid-template-columns: 100px 100px;
}
.item {
align-self: 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-height": 150, "data-offset-y": 0 },
item2: { "data-expected-height": 150, "data-offset-y": 0 }
});
item1.style.alignSelf = "center";
item2.style.alignSelf = "center";
evaluateStyleChangeMultiple("after", {
item1: { "data-expected-height": 50, "data-offset-y": 50 },
item2: { "data-expected-height": 100, "data-offset-y": 25 }
});
done();
}
</script>
<body onload="runTest()">
<div class="grid" id="grid">
<div id="item1" class="item" style="width: 50px; grid-area: 1 / 1;">
<div style="height: 50px;"></div>
</div>
<div id="item2" class="item" style="width: 50px; grid-area: 1 / 2;">
<div style="height: 100px;"></div>
</div>
</div>
</body>