Centering with display table
suggest changeHTML:
<div class="wrapper">
<div class="outer">
<div class="inner">
centered
</div>
</div>
</div>
CSS:
.wrapper {
height: 600px;
text-align: center;
}
.outer {
display: table;
height: 100%;
width: 100%;
}
.outer .inner {
display: table-cell;
text-align: center;
vertical-align: middle;
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents