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/abspos/row-masonry-out-of-flow-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masonry Test: Masonry layout out-of-flow positioning</title>
<link rel="author" title="Yanling Wang" href="mailto:yanlingwang@microsoft.com">
<link rel="match" href="row-masonry-out-of-flow-001-ref.html">
<style>
.container {
width: 900px;
height: 600px;
border: 2px solid black;
margin: 20px;
}
.masonry {
display: masonry;
masonry-direction: row;
grid-template-rows: repeat(4, 8rem);
align-content: center;
position: relative;
height: 32rem;
width: 800px;
padding: 20px;
gap: 10px;
}
.abspos-first {
grid-row: span 2;
position: absolute;
top: 80px;
bottom: 30px;
left: 70px;
right: 440px;
background: blue;
}
.abspos-second {
grid-row: 4 / 5;
position: absolute;
top: 10px;
left: 10px;
width: 100px;
height: 60px;
background: red;
}
.abspos-third {
grid-row: 4 / 5;
position: absolute;
width: 50px;
height: 60px;
background: yellow;
align-self: end;
}
.fixedpos {
position: fixed;
left: 50%;
bottom: 0;
width: 80px;
height: 40px;
background: green;
}
.static-span-two {
position: absolute;
width: 120px;
height: 30px;
background: lightcoral;
border: 2px solid red;
grid-row: span 2;
}
</style>
</head>
<body>
<div class="container">
<div class="masonry">
<div class="abspos-first"></div>
<div class="abspos-second"></div>
<div class="abspos-third"></div>
<div class="fixedpos"></div>
<div class="static-span-two"></div>
</div>
</div>
</body>
</html>