<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
#container{
height:400px;
display:table-cell;
vertical-align:middle;
}
</style>
</head>
<body>
<div id="container">
<p>我是第一行文本</p>
<p>我是第一行文本</p>
<p>我是第一行文本</p>
<p>我是第一行文本</p>
<p>我是第一行文本</p>
<p>我是第一行文本</p>
</div>
</body>
</html>
父元素高度确定的多行文本垂直居中显示
最新推荐文章于 2021-09-28 11:04:16 发布