我必須製作比常規要大的<input>
。高度必須是55px。我無法垂直對齊橙色方塊內的字形圖像。它看起來像這樣: 如何垂直對齊大於默認的<input>內的自舉字形
我已經用我的<i>
元素的margin-top嘗試,但降得它移動矩形,我需要移動剛剛字形。它看起來像這樣:
請讓我知道,如果你有任何想法如何我可以垂直居中橙色框中的字形。 我已經安裝在https://jsfiddle.net/vteL375o/1/
HTML中的jsfiddle:
<div class="container">
<div class="form-group has-feedback" style="margin-top:20px;">
<input type="text" id="search-query" class="form-control not-rounded search-input">
<i class="glyphicon glyphicon-search form-control-feedback glyph-class" style=""></i>
</div>
</div>
CSS:
.not-rounded {
border-radius: 0;
}
.search-input {
font-size: 20px;
margin-bottom: 50px;
height: 55px;
}
.glyph-class {
height: 55px;
width: 55px;
color:white;
background-color: orange;
font-size: 20px;
}
感謝您的回答,有沒有這種方法的優點,而不是改變線高? – Keatinge
它更靈活,所以你不必硬編碼'行高'值。 –