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/masonry/tentative/track-sizing/masonry-track-sizing-check-grid-height-on-resize.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<meta charset="utf-8">
<title>CSS Test: Masonry grid container size changes when item sizes change</title>
<link rel="author" title="Brandon Stewart" href="mailto:brandonstewart@apple.com">
<link rel="match" href="masonry-track-sizing-check-grid-height-on-resize-ref.html">
<meta name="assert" content="Test passes if when the size of an item in the masonry grid changes, the grid container is properly resized">
</head>
<style>
grid {
display: inline-grid;
grid-template-rows: masonry;
grid-template-columns: auto;
grid-gap: 10px;
border: 10px;
border-style: solid;
}
item {
background-color: grey;
height: 250px;
width: 250px;
}
</style>
</head>
<body>
<grid>
<item>1</item>
<item>2</item>
</grid>
</body>
<script>
document.body.offsetHeight; // Force a relayout
var gridItem = document.querySelector('item');
gridItem.style.height = '125px';
gridItem.style.width = '300px';
document
document.documentElement.className = '';
</script>
</html>