1. 程式人生 > >css 中讓多行內容垂直居中的方法

css 中讓多行內容垂直居中的方法

HTML程式碼:

<div class="textList">
            
    <p>為您提供世界級的包裝產品,我們完善的管理體系為您確保產品質量可靠穩定</p>
    <p>為您提供世界級的包裝產品,我們完善的管理體系為您確保產品質量可靠穩定</p>
</div>

css程式碼:

.textList{line-height: 30px;text-align: center; display: table-cell;vertical-align: middle;width: 100%;}

關鍵程式碼:display: table-cell;vertical-align: middle;