<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>42度空间-固定高度的块元素垂直居中</title>
    <style>
        .parent {
            height: 140px;
            position: relative;
            border: 2px dashed #f69c55;
        }
        .child {
            position: absolute;
            top: 50%;
            height: 100px;
            margin-top: -50px;
            color:#fff;
            background: #000;

        }
    </style>
</head>
<body>
<div class="parent">
    <div class="child">控制复杂性是计算机编程的本质。</div>
</div>
</body>
</html>