<h2>Flex</h2>
<div class="container flex">
<div class="item">One</div>
<div class="item">Two<br>Two</div>
<div class="item">Three<br>Three <br>Three</div>
</div>
<h2>Grid</h2>
<div class="container grid">
<div class="item">One</div>
<div class="item">Two<br>Two</div>
<div class="item">Three<br>Three <br>Three</div>
</div>
body {
padding: 60px;
font: 1em Helvetica Neue, Helvetica, Arial, sans-serif;
}
* {box-sizing: border-box;}
p {
margin: 0 0 1em 0;
}
.flex {
display: flex;
align-items: flex-end;
}
.flex .item:first-child {
align-self: center;
}
.grid {
display: grid;
align-items: center;
justify-items: end;
grid-template-columns: 1fr 1fr 1fr;
}
.grid .item:first-child {
grid-column: 1 / 3;
align-self: start;
justify-self: center;
}
.container {
width: 400px;
border: 5px solid rgb(111,41,97);
border-radius: .5em;
padding: 10px;
}
.item {
padding: 10px;
background-color: rgba(111,41,97,.3);
border: 2px solid rgba(111,41,97,.5);
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.