E {
top: 0; /* сверху */
bottom: 0; /* снизу */
text-align: center; /* горизонтально */
vertical-align: middle; /* вертикально */
}
<div class="poem">
<div>буря мглою</div>
<div>небо кроет</div>
<div>вихри снежные</div>
<div>крутя</div>
</div>
.poem {
overflow: hidden;
height: 640px;
}
.poem div {
float: left;
}
.poem div:first-child {
background: #090;
}
.poem div:last-child {
background: #C00;
}
.poem {
display: flex;
}
.poem {
display: flex;
flex-direction: row; /* по умолчанию */
flex-direction: row-reverse;
}
.poem {
display: flex;
flex-direction: column;
}
.poem {
display: flex;
flex-direction: column-reverse;
}
.poem {
display: flex;
justify-content: flex-start; /* по умолчанию */
justify-content: flex-end;
}
.poem {
display: flex;
justify-content: center;
}
.poem {
display: flex;
justify-content: space-between;
}
.poem {
display: flex;
justify-content: space-around;
}
.poem div:nth-child(2) {
order: 1;
}
.poem div {
order: 4;
}
.poem div:nth-child(1) { order: 2 }
.poem div:nth-child(2) { order: 1 }
.poem div:nth-child(3) { order: 4 }
.poem div:nth-child(4) { order: 3 }
.poem div {
height: 250px;
}
.poem {
display: flex;
align-items: flex-start; /* по умолчанию */
align-items: flex-end;
}
.poem {
display: flex;
align-items: center;
}
.poem div:nth-child(1) {
align-self: flex-start;
}
.poem div:nth-child(4) {
align-self: flex-end;
}
.poem {
display: flex;
}
.poem div {
margin: auto;
}
.poem div {
flex-grow: 1;
}
.poem div {
flex-grow: 1;
}
.poem div:nth-child(1) {
flex-grow: 4;
}
.poem div {
width: 25%;
}
.poem div:nth-child(1) {
flex-shrink: 4;
}
.poem div {
flex-grow: 1;
}
.poem div:nth-child(1) {
flex-basis: 250px;
}
.poem {
display: flex;
flex-wrap: nowrap; /* по умолчанию */
flex-wrap: wrap;
}
.poem {
display: flex;
flex-wrap: wrap-reverse;
}
.poem {
display: flex;
align-content: stretch; /* по умолчанию */
align-content: center;
}
Только для многострочных блоков!
E {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
E {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-ms-flex: 1;
-webkit-flex: 1;
flex: 1;
}
E { -webkit-box-orient: vertical;
-moz-box-orient: vertical;
-ms-flex-direction: column;
-webkit-flex-direction: column;
flex-direction: column; }
E { -webkit-box-orient: vertical;
-webkit-box-direction: reverse;
-moz-box-orient: vertical;
-moz-box-direction: reverse;
-ms-flex-direction: column-reverse;
-webkit-flex-direction: column-reverse;
flex-direction: column-reverse; }
E { -webkit-box-orient: horizontal;
-webkit-box-direction: reverse;
-moz-box-orient: horizontal;
-moz-box-direction: reverse;
-ms-flex-direction: row-reverse;
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse; }
E {
-webkit-box-pack: justify;
-moz-box-pack: justify;
-ms-flex-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
}
E {
-webkit-box-align: center;
-moz-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
}
E {
-webkit-box-ordinal-group: 1;
-moz-box-ordinal-group: 1;
-ms-flex-order: 1;
-webkit-order: 1;
order: 1;
}
Вадим Макеев, Opera Software
Презентация: pepelsbey.net/pres/flexbox-gotcha