[英]CSS: how to align text content horizontally-centered and vertically-centered?
如何在div水平居中和垂直居中的內部對齊文本內容?
<div style="height: 300px;">
<p>Envision various details for your big day with help from our photo catalog, which features images filtered by category. See actual works from suppliers to help you make decisions.</p>
</div>
你需要使用display: table-cell;
和vertical-align: middle;
具有text-align: center;
屬性text-align: center;
以及垂直和水平居中對齊文本
div {
border: 1px solid #f00;
display: table-cell;
text-align: center;
vertical-align: middle
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.