<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>42度空间-块级元素水平居中</title>
    <style>
        div {
            height:100px;
            border: 2px dashed #f69c55;
        }
        .center-block {
            margin: 0 auto;
            width: 8rem;
            padding:1rem;
            color:#fff;
            background:#000;
        }
    </style>
</head>
<body>
<div>
    <p class="center-block">
        简单不先于复杂,而是在复杂之后。
    </p>
</div>
</body>
</html>