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/alignment/row-masonry-align-self-002.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masonry Test: Masonry layout with `align-self` advanced values and safe/unsafe alignment</title>
<link rel="author" title="Yanling Wang" href="mailto:yanlingwang@microsoft.com">
<link rel="match" href="row-masonry-align-self-002-ref.html">
<style>
html,body {
color:black; background-color:white; font:15px/1 monospace; padding:0; margin:0;
}
.masonry {
display: masonry;
gap: 2px;
grid-template-rows: repeat(3, 40px);
masonry-direction: row;
color: #444;
border: 1px solid;
padding: 2px;
width: 180px;
margin: 5px;
vertical-align: top;
}
item {
background-color: #444;
color: #fff;
padding: 2px;
width: 45px;
}
.safe-end {
align-self: safe end;
background-color: purple;
height: 50px;
}
.safe-center {
align-self: safe center;
background-color: teal;
height: 45px;
}
.unsafe-end {
align-self: end;
background-color: darkmagenta;
height: 50px;
}
.unsafe-center {
align-self: center;
background-color: darkcyan;
height: 45px;
}
.self-start {
align-self: self-start;
background-color: darkred;
}
.self-end {
align-self: self-end;
background-color: darkblue;
}
.normal {
align-self: normal;
background-color: brown;
}
.short {
height: 15px;
}
</style>
</head>
<body>
<div class="masonry">
<item class="normal">N1</item>
<item class="safe-end">SE1</item>
<item class="normal">N2</item>
<item class="normal">N3</item>
<item class="unsafe-end">UE1</item>
<item class="normal">N4</item>
</div>
<div class="masonry">
<item class="normal">N1</item>
<item class="safe-center">SC1</item>
<item class="normal">N2</item>
<item class="normal">N3</item>
<item class="unsafe-center">UC1</item>
<item class="normal">N4</item>
</div>
<div class="masonry">
<item class="self-start short">SS1</item>
<item class="self-end short">SE2</item>
<item class="self-start short">SS3</item>
<item class="self-end short">SE4</item>
<item class="self-start short">SS5</item>
<item class="self-end short">SE6</item>
</div>
</body>
</html>