[英]How to text-align center this label text?
如何垂直對齊此文本的中心?
從:
至:
<<p>
<label></label>
<input type="checkbox" id="checkbox" name="checkbox" class="regular-checkbox big-checkbox" value="Yes" checked="checked">
<label for="checkbox" style="margin-right:10px;"></label>Subscribe me to your mailing list for upcoming events, hot offers and deals
</p>
作為反直覺的,因為它看起來,你需要添加vertical-align: middle
你要垂直對齊,而不是元素要垂直對齊(元素在這種情況下, label[for=checkbox]
。
在這里查看演示: http : //jsfiddle.net/E5CxM/2/
使用line-height使文本垂直居中
label{
line-height: 45px;
height: 45px;
display: inline-block;
}
這是一個如何工作的簡單示例:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.