0
我試圖在自舉堆疊導航中放置一個小圖像及其文本,使文本應該垂直對齊到<img>
。Bootstrap 3對齊堆疊式導航中的圖像和鏈接
這裏是我的代碼:
HTML
<ul class="nav nav-tabs nav-stacked" style="list-style-type:none;">
<li>
<a href="#" class="side-list"><img height="30" width="30" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcR-jw84XlLxTYJoFlqzKr5AVoFoDjVwNCakmB5Rtv1UIW3VqG2h"> Stacked List 1</a>
</li>
<li>
<a href="#" class="side-list"><img height="30" width="30" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcR-jw84XlLxTYJoFlqzKr5AVoFoDjVwNCakmB5Rtv1UIW3VqG2h"> Stacked List 2 </a>
</li>
<li>
<a href="#" class="side-list"><img height="30" width="30" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcR-jw84XlLxTYJoFlqzKr5AVoFoDjVwNCakmB5Rtv1UIW3VqG2h"> Stacked List 3 </a>
</li>
</ul>
CSS
.side-list{
padding-top:15px;
padding-bottom:11px;
text-align:center;
display:block !important;
color:#000;
font-weight: bold;
}
跨度的父必須有顯示:表細胞;爲了達成這個。 – kmike
@kmike請參考我的[** JSFiddle **](http://jsfiddle.net/vivekkupadhyay/wp830Lyv/1/) – vivekkupadhyay
非常感謝這對我工作。 – prit4fun