Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-grid/subgrid/sibling-nested-subgrids-overflow-hidden-contribution.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Test: Sibling nested subgrids with overflow:hidden leaf contribute equally to their tracks</title>
<meta name="assert" content="Test passes if the row heights of nested-subgrid leaves with overflow:hidden are identical across sibling subgrids, regardless of each sibling's position in the outer grid. This test only checks row sizing; column sizing is not exercised.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.grid {
display: grid;
gap: 16px;
width: 400px;
}
.card {
border: 1px solid black;
display: grid;
grid-template-rows: subgrid;
grid-row: span 3;
row-gap: 0;
}
.content {
display: grid;
grid-template-rows: subgrid;
grid-row: span 2;
padding: 16px;
}
.footer {
overflow: hidden;
}
</style>
</head>
<body>
<div class="grid">
<div class="card">
<h2>Top</h2>
<div class="content">
<div class="footer" id="f1">
Long text long enough to wrap onto multiple lines so that overflow:hidden can clip the overflowing portion
</div>
</div>
</div>
<div class="card">
<h2>Top</h2>
<div class="content">
<div class="footer" id="f2">
Long text long enough to wrap onto multiple lines so that overflow:hidden can clip the overflowing portion
</div>
</div>
</div>
<div class="card">
<h2>Top</h2>
<div class="content">
<div class="footer" id="f3">
Long text long enough to wrap onto multiple lines so that overflow:hidden can clip the overflowing portion
</div>
</div>
</div>
</div>
<script>
test(() => {
const h1 = document.getElementById("f1").getBoundingClientRect().height;
const h2 = document.getElementById("f2").getBoundingClientRect().height;
const h3 = document.getElementById("f3").getBoundingClientRect().height;
assert_equals(h2, h1, "Second card's .footer height matches the first's");
assert_equals(h3, h1, "Third card's .footer height matches the first's");
}, "Sibling nested subgrids with overflow:hidden leaves must size their rows identically");
</script>
</body>
</html>