. . , , .
flex-basis flex-grow, 50% .
- 50% container display: flex; flex-wrap: wrap;.
,
html, body {
height: 100%;
margin: 0;
}
.container {
height: 100%;
}
.column {
height: 25%;
}
@media screen and (min-width: 600px) {
.container {
display: flex;
flex-wrap: wrap;
}
.column {
flex-basis: 50%;
height: 50%;
}
}
body {
font-family: 'Lato', sans-serif;
font-size: 1.3em;
color: #ccc;
background: #000;
}
.column {
padding: 15px;
box-sizing: border-box;
}
.column:nth-child(1) {
background: #5c9;
}
.column:nth-child(2) {
background: #fb0;
}
.column:nth-child(3) {
background: #39f;
}
.column:nth-child(4) {
background: #f33;
}
main {
max-width: 1200px;
margin: 0 auto;
}
h1,
h2 {
text-align: center;
}
<div class="container">
<div class="column">
50%
</div>
<div class="column">
50%
</div>
<div class="column">
50%
</div>
<div class="column">
50%
</div>
</div>
Hide result
,
html, body {
height: 100%;
margin: 0;
}
.row {
height: 50%;
}
.column {
height: 50%;
}
@media screen and (min-width: 600px) {
.row {
display: flex;
}
.column {
flex-basis: 50%;
height: 100%;
}
}
body {
font-family: 'Lato', sans-serif;
font-size: 1.3em;
color: #ccc;
background: #000;
}
.column {
padding: 15px;
box-sizing: border-box;
}
.row:nth-child(1) .column:nth-child(1) {
background: #5c9;
}
.row:nth-child(1) .column:nth-child(2) {
background: #fb0;
}
.row:nth-child(2) .column:nth-child(1) {
background: #39f;
}
.row:nth-child(2) .column:nth-child(2) {
background: #f33;
}
main {
max-width: 1200px;
margin: 0 auto;
}
h1,
h2 {
text-align: center;
}
<div class="row">
<div class="column">
50%
</div>
<div class="column">
50%
</div>
</div>
<div class="row">
<div class="column">
50%
</div>
<div class="column">
50%
</div>
</div>
Hide result
i.e.:
Flexbox - https://jsfiddle.net/0ns6ofcp/
.column {
height: 25%;
display: flex;
justify-content: center;
align-items: center;
}
Transform - https://jsfiddle.net/0ns6ofcp/1/
<div class="column">
<div>50%</div>
</div>
.column {
position: relative;
height: 25%;
}
.column > div {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}