<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>42度空间-利用flex布局实现元素水平垂直居中</title>
    <style>
        .parent {
            height: 140px;
            display: flex;
            justify-content: center;
            align-items: center;
            border: 2px dashed #f69c55;
        }
        .child {
            padding: 20px;
            background: black;
            color: #fff;
        }
    </style>
</head>
<body>
<div class="parent">
    <div class="child">Facebook wasn't built in a day.</div>
</div>
</body>
</html>