1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
<!doctype html>
<meta charset="UTF-8">
<title>Self-Alignment: justify-self - block-level elements reference</title>
<link rel="author" title="David Tran" href="mailto:davidtranhq+wpt@gmail.com" />
<style>
.grid-container div {
width: 100px;
background-color: green;
}
.stack {
display: grid;
}
.stack > * {
grid-row: 1;
grid-column: 1;
}
body {
width: 700px;
}
</style>
<p>Test passes if <strong>no red</strong> is visible</p>
<div class="stack" style="float: left;">
<article class="grid-container" style="display: grid; grid-template-columns: 1fr; width: 300px">
<div style="justify-self: auto;">auto</div>
<div style="justify-self: normal;">normal</div>
<div style="justify-self: stretch; width: auto; margin: 0;">stretch</div>
<div style="justify-self: stretch; margin: 0;">stretch</div>
<div style="justify-self: stretch; width: auto; margin: auto;">stretch</div>
<div style="justify-self: left;">left</div>
<div style="justify-self: right;">right</div>
<div style="justify-self: start;">start</div>
<div style="justify-self: center;">center</div>
<div style="justify-self: end;">end</div>
<div style="justify-self: self-start;">self-start</div>
<div style="justify-self: self-end;">self-end</div>
<div style="justify-self: flex-start;">flex-start</div>
<div style="justify-self: flex-end;">flex-end</div>
<div style="float: left; justify-self: center;">float left</div>
<div style="float: right; justify-self: center;">float right</div>
<div style="justify-self: self-start; direction: rtl">self-start (rtl)</div>
<div style="justify-self: self-end; direction: rtl">self-end (rtl)</div>
<div style="justify-self: start; direction: rtl">start (rtl)</div>
<div style="justify-self: end; direction: rtl">end (rtl)</div>
<div style="justify-self: end">end parent
<div style="position: absolute;">absolute child</div>
</div>
<div style="justify-self: end; position: absolute;">absolute parent</div>
</article>
</div>
<div class="stack" style="float: right; direction: rtl">
<article class="grid-container" style="display: grid; grid-template-columns: 1fr; width: 300px">
<div style="justify-self: auto;">auto</div>
<div style="justify-self: normal;">normal</div>
<div style="justify-self: stretch; width: auto; margin: 0;">stretch</div>
<div style="justify-self: stretch; margin: 0;">stretch</div>
<div style="justify-self: stretch; width: auto; margin: auto;">stretch</div>
<div style="justify-self: left;">left</div>
<div style="justify-self: right;">right</div>
<div style="justify-self: start;">start</div>
<div style="justify-self: center;">center</div>
<div style="justify-self: end;">end</div>
<div style="justify-self: self-start;">self-start</div>
<div style="justify-self: self-end;">self-end</div>
<div style="justify-self: flex-start;">flex-start</div>
<div style="justify-self: flex-end;">flex-end</div>
<div style="float: left; justify-self: center;">float left</div>
<div style="float: right; justify-self: center;">float right</div>
<div style="justify-self: self-start; direction: ltr">self-start (ltr)</div>
<div style="justify-self: self-end; direction: ltr">self-end (ltr)</div>
<div style="justify-self: start; direction: ltr">start (ltr)</div>
<div style="justify-self: end; direction: ltr">end (ltr)</div>
<div style="justify-self: end">end parent
<div style="position: absolute;">absolute child</div>
</div>
<div style="justify-self: end; position: absolute;">absolute parent</div>
</article>
</div>
|