<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>42度空间-固定宽高元素水平垂直居中</title>
    <style>
        .parent {
            height: 140px;
            position: relative;
            border: 2px dashed #f69c55;
        }
        .child {
            width: 200px;
            height: 80px;
            padding: 10px;
            position: absolute;
            top: 50%;
            left: 50%;
            margin: -50px 0 0 -110px;
            background: black;
            color: #fff;
        }
    </style>
</head>
<body>
<div class="parent">
    <div class="child">控制复杂性是计算机编程的本质。</div>
</div>
</body>
</html>