我在對齊我的標籤時遇到問題。多個標籤的對齊 - HTML,CSS
我現在所擁有的:
HTML:
<div class="personalinformation">
<label for="" class="info">Firstname:</label>
<label for="">Bill</label>
</div>
<div class="personalinformation">
<label for="" class="info">Lastname:</label>
<label for="">Gates</label>
</div>
<div class="personalinformation">
<label for="" class="info">Country:</label>
<label for="">France</label>
</div>
CSS:
.personalinformation {
text-align: center;
margin-left: auto;
text-justify: inter-word;
margin: 0 auto 1em auto;
}
.info {
font-weight: bold;
text-align: left;
margin-right: 50px;
}
如何讓我的標籤,這樣的排列:
如果我想擁有像你這樣的所有標籤,但在頁面的中心位置,該怎麼辦? – pPeter
設置一個容器div,其中包含所有內容,設置一個特定的寬度並使用margin屬性的自動屬性。看:http://www.bootply.com/q9x6cX9dFj – robertina
但你有多餘的空間,在右邊的div容器所以只有DIV居中,但文字是不是。 – Darren