Container alter its items (width/height) to best fill the available space
Direction-agnostic instead of vertically-based (block) or horizontally-based (inline)
Bonus : baseline
.container {
display: flex;
align-items: baseline;
}
.container {
display: flex;
/* flex-direction: row; */
}
.container {
display: flex;
flex-direction: column;
}
.container {
display: flex;
flex-direction: row-reverse;
}
.item:nth-child(5) {
order: -1;
}
.item:nth-child(4) {
order: -1;
}
.item:nth-child(2) {
order: 1;
}
.container {
display: flex;
justify-content: center;
}
.container {
display: flex;
justify-content: space-between;
}
.container {
display: flex;
flex-direction:column;
justify-content: space-between;
}
.container {
display: flex;
justify-content: space-around;
}
.container {
display: flex;
height: 200px;
/* align-items: stretch; */
}
.container {
display: flex;
height: 200px;
align-items: center;
}
.container {
display: flex;
height: 200px;
align-items: baseline;
}
.container {
display: flex;
height: 200px;
align-items: flex-end;
}
.item:nth-child(3) {
align-self: stretch;
}
.container {
display: flex;
height: 200px;
}
.item:nth-child(3) {
margin-left: auto;
}
.container {
display: flex;
height: 200px;
}
.item:nth-child(1) {
margin-right: auto;
}
.item:nth-child(3) {
margin-left: auto;
}
.container {
display: flex;
height: 200px;
}
.item {
margin: auto;
}
.container {
display: flex;
flex-wrap: wrap;
}
.item {
flex: 1 0 150px; // flex-grow flex-shrink flex-basis
}
.container {
display: flex;
flex-wrap: wrap;
align-content: flex-end;
}
.container {
display: flex;
flex-wrap: wrap;
align-content: stretch;
}
.container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
align-content: stretch;
}
Spare space?
.container {
display: flex;
}
.item:nth-child(4) {
flex-grow: 1;
}
.container {
display: flex;
}
.item:nth-child(4) {
flex-grow: 1;
}
.item:nth-child(5) {
flex-grow: 2;
}
Missing space?
.container {
display: flex;
}
.item {
/* flex-shrink: 1; */
}
.container {
display: flex;
}
.item {
flex-shrink: 0;
}
.container {
display: flex;
}
.item {
flex-shrink: 0;
}
.item:nth-child(7) {
flex-shrink: 1;
}
.container {
display: flex;
}
.item {
flex-shrink: 0;
}
.item:nth-child(7) {
flex-shrink: 1;
}
.item:nth-child(8) {
flex-shrink: 2;
}
Size before space attribution
.container {
display: flex;
}
.item {
flex-basis: 150px;
}
.container {
display: flex;
}
.item {
flex-basis: 150px;
}
.item:nth-child(1) {
flex-grow: 1;
}
.container {
display: flex;
}
.item {
flex-basis: 150px;
flex-shrink: 0;
}
.item:nth-child(5) {
flex-shrink: 1;
}
.container {
display: flex;
}
.item {
flex: 1 0 150px; // flex-grow flex-shrink flex-basis
}
.item:nth-child(2) {
min-width: 250px;
}
.item:nth-child(4) {
max-width: 50px;
}
h3 {
display: flex;
align-items: center;
}
h3::before,
h3::after {
content: "";
border-bottom: solid #000032 1px;
flex-grow: 1;
}
Lorem ipsum
Dolores
.media {
display: flex;
}
.media-body {
display: flex;
flex-wrap: wrap;
align-items: baseline;
}
.media-image {
flex-shrink: 0;
}
.media-name {
flex: 1 0 auto; // flex-grow flex-shrink flex-basis
}
.media-text {
flex: 1 0 100%; // flex-grow flex-shrink flex-basis
}
form {
display: flex;
}
input[type="email"] {
flex-grow: 1;
}