表單 文字和輸入框對齊的最簡單的方法


關鍵:

1.父元素(例如div)設置為text-align:center; 

2.span元素要垂直居中,要設置line-height;同時input也要設置line-height ;兩者的值設置成一樣的。已經經過測試,ie8、chrome下沒問題。

<div class="enter_eamil_section">
<span>郵箱</span><input type="text" name="email"/>
</div>

 

.enter_eamil_section{
text-align:center;
margin:45px 0;
}
.enter_eamil_section span{
font-size:16px;
margin-right:10px;
line-height:30px;
}
.enter_eamil_section input{
width:278px;
height:30px;
border:1px solid #b2bfc8;
line-height:30px;
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM