Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html>
<link rel="help" href="https://drafts.csswg.org/css-grid-3">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<link rel="match" href="row-auto-placement-002-ref.html">
<link rel="author" title="Alison Maher" href="mailto:almaher@microsoft.com">
<style>
.masonry {
display: masonry;
background: gray;
item-tolerance: 0;
grid-template-rows: auto auto auto;
masonry-direction: row;
width: 870px;
padding: 20px;
gap: 20px;
font: 15px/1 "Ahem";
}
.masonry > div {
width: max-content;
}
.auto-item {
padding: 10px;
}
.auto-item:nth-of-type(1) {
background: lightskyblue;
}
.auto-item:nth-of-type(2) {
background: lightcoral;
}
.auto-item:nth-of-type(3) {
background: lightgreen;
}
.two-track-spanner {
background: lightpink;
grid-row: span 2;
padding: 10px;
}
</style>
<body>
<p>Test that masonry items with auto placement are correctly positioned within the grid axis.</p>
<div class="masonry">
<div class="auto-item">This is some text</div>
<div class="auto-item">Some larger words in this sentence</div>
<div class="auto-item">The cat cannot be separated from milk</div>
<div class="two-track-spanner">The cat still cannot be separated from milk</div>
<div class="two-track-spanner">The cat still cannot be separated from milk</div>
</div>
</body>
</html>