Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
-->
<html>
<head>
<meta charset="utf-8">
<title>Verify correct sizing of flex tracks when using subgrid in CSS Masonry</title>
<link rel="author" title="Brandon Stewart" href="mailto:brandonstewart@apple.com">
<link rel="match" href="masonry-subgrid-flex-ref.html">
<style>
grid {
display: inline-grid;
grid-template-columns: 1fr 2fr 3fr;
grid-template-rows: masonry;
border: 1px solid;
background: lightgrey;
}
subgrid {
display: grid;
grid-template-columns: subgrid;
grid-column: 2 / span 2;
background: lightblue;
}
</style>
</head>
<body>
<!-- Verify basic subgrid -->
<grid>
<item>1</item>
<subgrid>
<item>2</item>
<item>3</item>
<item>4</item>
</subgrid>
<item>5</item>
</grid>
<!-- Verify subgrid with first item in subgrid set to 2ch -->
<grid>
<item>1</item>
<subgrid>
<item style="width: 2ch">2</item>
<item>3</item>
<item>4</item>
</subgrid>
<item>5</item>
</grid>
<!-- Verify subgrid with second item in subgrid set to 3ch -->
<grid>
<item>1</item>
<subgrid>
<item>2</item>
<item style="width: 3ch">3</item>
<item>4</item>
</subgrid>
<item>5</item>
</grid>
<!-- Verify subgrid with final item in subgrid set to 4ch -->
<grid>
<item>1</item>
<subgrid>
<item>2</item>
<item>3</item>
<item style="width: 4ch">4</item>
</subgrid>
<item>5</item>
</grid>
<!-- Verify behavior when subgrid is set to masonry too -->
<grid>
<item>1</item>
<subgrid style="grid-template-rows: masonry">
<item>2</item>
<item style="width: 3ch">3</item>
<item>4</item>
</subgrid>
<item>5</item>
</grid>
</body>
</html>