<figure class="d-container">
<div class="d-flex-vertical">
<div class="d-flex-vertical-center">
CSS Vertical centering is a sign of the apocalypse.
</div>
</div>
</figure>
* {
margin: 0;
padding: 0
}
li {
list-style: none
}
* {
box-sizing: border-box
}
body {
font-size: 100%;
line-height: 1.6
}
.d-container:first-child {
margin-top: 0
}
.d-container {
background: #f7f7f7;
border-bottom: 1px solid #eee;
margin: 2em auto;
padding: 2em 5%;
width: 100%
}
.d-container:after {
clear: both;
content: "";
display: table
}
.d-container>h1 {
color: #333;
font-size: 2em;
line-height: 1.2;
margin: 0 0 .5em;
text-align: center
}
.d-flex-vertical {
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
min-height: 15em
}
.d-flex-vertical-center {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
background: #fff;
color: #333;
padding: 2.5em;
-webkit-box-flex: 0;
-webkit-flex: 0 0 200px;
-ms-flex: 0 0 200px;
flex: 0 0 200px;
border: 1px solid #ddd
}
@media all and (min-width: 30em) {
.d-flex-vertical-center {
-webkit-box-flex: 0;
-webkit-flex: 0 0 400px;
-ms-flex: 0 0 400px;
flex: 0 0 400px
}
}
This Pen doesn't use any external CSS resources.