文字垂直置中

 

範例如下

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
</head>

<body>
    <style>
        .partial {
            height: 100px;
            text-align: center;
            border: 1px black dashed;
        }

        .partial:before {
            content: '';
            height: 100%;
            display: inline-block;
            vertical-align: middle;
        }

        .partial>span {
            vertical-align: middle;
        }
    </style>

    <div class="partial">
        <span>
            MyPartial
        </span>
    </div>
</body>

</html>