程序员

【HTML中垂直居中】【文本】一行文本垂直居中

2018-11-02  本文已影响1人  fanlehai

使用line-height属性,让文字的行高和容器的高度相同即可:

<html>

<head>
    <style type="text/css">
        #wrapper {
            height: 100px;
            background-color: rgb(87, 87, 92);
        }

        .content {
            line-height:100px;
        }
    </style>
</head>

<body>
    <div id="wrapper">
        <div id="cell">
            <p class="content">Content goes here</p>
        </div>
    </div>
</body>
</html>


参考链接:
上一篇 下一篇

猜你喜欢

热点阅读