<div class="wrapper">
<div class="content">
Hello world!<br>
How are you today?
</div>
</div>.wrapper {
position: relative;
}
.content {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}.wrapper {
display: table;
}
.wrapper-inner {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.content {
display: inline-block;
}.wrapper:before {
content: "";
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -0.25em;
}
.content {
display: inline-block;
vertical-align: middle;
}.wrapper {
display: flex;
justify-content: center;
align-items: center;
}.wrapper {
display: flex;
}
.column {
flex: 1;
/* Shorthand für flex-grow: 1 */
}http://jsbin.com/yoxag/edit?html,css,output
<div class="wrapper">
<div class="column">
Column 1
</div>
<div class="column">
Column 2
</div>
<div class="column">
Column 3
</div>
<div class="column">
Column 4
</div>
</div>.wrapper {
display: flex;
}
.column {
flex: 1;
}
.column.var-wide {
flex: 2;
}<div class="wrapper">
<div class="column">
Column 1
</div>
<div class="column var-wide">
Column 2
</div>
<div class="column">
Column 3
</div>
</div>.wrapper {
display: flex;
}
.column {
flex: 1;
}
@media (max-width: 30em) {
.wrapper {
display: block;
/* Alternative: flex-direction: column; */
}
}.wrapper {
display: flex;
}
.column {
flex: 1;
}
@media (max-width: 30em) {
.wrapper {
flex-direction: column;
}
.column:last-child {
order: -1;
}
}form {
display: flex;
}
input {
flex: 1;
}<form>
<input type="text">
<button type="submit">
Submit
</button>
</form>/* Floats */
.no-flexbox.no-flexboxlegacy .wrapper:after {
clear: both;
content: "";
display: table;
}
.no-flexbox.no-flexboxlegacy .column {
float: left;
width: 25%;
}/* Tables */
.no-flexbox.no-flexboxlegacy .wrapper {
display: table;
table-layout: fixed;
width: 100%;
}
.no-flexbox.no-flexboxlegacy .column {
display: table-cell;
width: 50%; /* arbitrary width */
}.wrapper {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.column {
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
.column:last-child {
-webkit-box-ordinal-group: 0;
-webkit-order: -1;
-ms-flex-order: -1;
order: -1;
}.wrapper {
display: flex;
}
.column {
flex: 1;
}
.column:last-child {
order: -1;
}Theorie
Praxis
Thomas Jaggi
@backflip
thomas.jaggi@unic.com