父元素高度確定的多行文本垂直居中顯示

<!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>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章