Flexbox Example Twelve

Example: Perfect Centering

This is perfectly centered!

HTML

<div class="centeredbox">This is perfectly centered!</div>

CSS

.centeredbox {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 300px;
    height: 300px;
    background-color: silver;
}