簡體   English   中英

圖片和文字不垂直對齊中間

[英]Image and text not vertical align to middle

我在CSS中嘗試了許多“ Display”參數,但似乎無法設置適當的對齊方式,請幫助我解決它。

<div id="fadeshow2toggler" style="text-align:center; width:290px;">
    <a href="#" class="prev"><img src="http://i31.tinypic.com/302rn5v.png"/></a>
    <div class="status">1 of 1</div>
    <a href="#" class="next"><img src="http://i30.tinypic.com/lzkux.png"/></a>
</div>

顯示將不會設置任何分配。

這可能就是您所需要的。

<style type="text/css">
    .prev, .next, .status{float:left;}
</style>

嘗試這個:

<center>
    <div id="fadeshow2toggler" style="text-align:center; width:290px;">
        <a href="#" class="prev"><img src="http://i31.tinypic.com/302rn5v.png"/></a>
        <div class="status">1 of 1</div>
        <a href="#" class="next"><img src="http://i30.tinypic.com/lzkux.png"/></a>
    </div>
</center>

您可以修改HTML嗎? 如果是這樣,請為兩個錨點和div添加一個容器,如下所示

<div id="fadeshow2toggler" style="width:290px;">
<div class="linkscontainer">
    <a href="#" class="prev"><img src="http://i31.tinypic.com/302rn5v.png"/></a>
    <div class="status">1 of 1</div>
    <a href="#" class="next"><img src="http://i30.tinypic.com/lzkux.png"/></a>
</div>
</div>

並使用此CSS

.linkscontainer{
  margin:0px auto;
  min-width:50%;
}

.status{
  display:inline;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM