0
我正在開發一個網站內的簡單導航元素,並試圖使用精靈頁面將圖像添加到「最後」和「下一步」文本按鈕。我可以讓它們全部正確顯示,但文本不會在這些元素上垂直居中。任何人有任何建議?垂直居中CSS Sprite和文本
<div class="post_nav">
<div class="last">Last</div>
<div class="home"> </div>
<div class="next">Next</div>
</div>
.post_nav { position: relative; width: 30%; margin: 10px auto; text-align: center; font-family: 'Bitter', Georgia, serif; font-weight: 700; color: #c9c9c9; }
.post_nav div { display: inline-block; text-transform: uppercase; padding: 0 20px; }
.post_nav .last:before { content: ""; width: 30px; height: 30px; line-height: 20px ; background: url('http://i.imgur.com/BlY1jqF.png') no-repeat -60px 0; float: left; margin: auto 5px; overflow: hidden; }
.post_nav .home:before { content: ""; width: 30px; height: 30px; line-height: 30px ; background: url('http://i.imgur.com/BlY1jqF.png') no-repeat -120px 0; float: left; margin: auto 5px; padding: 0; overflow: hidden; }
.post_nav .next:after { content: ""; width: 30px; height: 30px; line-height: 30px ; background: url('http://i.imgur.com/BlY1jqF.png') no-repeat -90px 0; float: right; margin: auto 5px; overflow: hidden; }
Here's the Fiddle for this issue.
爲什麼總是我離開了最愚蠢的事? :( 非常感謝。 – HawkeyeWeb