我在此處創建了一個博客模板:http://aergaergerg.blogspot.com.au/,正如您所看到的「精選帖子」的按鈕爲空。我想知道如何通過html小工具本身或css或任何可能的方式向他們添加文本。有些人可能會建議在圖片中加入文字,除了我的問題是因爲它是'精選文章',顯然這些鏈接會發生很大的變化。下面是想什麼,我實現了圖片:如何將文本添加到CSS Sprite
總之,這裏的HTML的功能後按鈕(CSS精靈):
<!--Social Sprite Html2-->
<div id="head-soc2">
<ul>
<li id="Button1"><a href="http://www.spaceheroesfansite.com/p/about.html">3</a> </li>
<li id="Button2"><a href="http://www.spaceheroesfansite.com/p/promo-codes.html"></a> </li>
<li id="Button3"><a href="http://www.spaceheroesfansite.com/p/game-tricks.html"></a></li>
<li id="Button4"><a href="http://www.spaceheroesfansite.com/p/purple-jacket-squad.html"></a></li>
<li id="Button5"><a href="http://www.spaceheroesfansite.com/p/purple-jacket-squad.html"></a></li>
</ul>
<!--Social Sprite Html2--></div>
併爲它的CSS:
/*Social Sprite Css Buttons*/
#head-soc2 ul li {list-style :none; padding: 0px; float: center;}
#head-soc2 ul li a {text-indent: -9999px; font-size: 0; line-height: 0; overflow: visible ; border: 0; background: url("http://3.bp.blogspot.com/-D2V1j-OWhrM/UqYsp5RVMuI/AAAAAAAADgI/IsObrayuepI/s1600/bannersprite2.png") no-repeat; display: block;}
#head-soc2 li#Button1 a{background-position: -787px 0px;height: 51px; width: 204px; margin-bottom:15px;}
#head-soc2 li#Button1 a:hover {background-position: -787px -51px;height: 51px; width: 204px}
#head-soc2 li#Button2 a {background-position: -787px 0px;height: 51px; width: 204px; margin-bottom:15px;}
#head-soc2 li#Button2 a:hover {background-position: -787px -51px;height: 51px; width: 204px}
#head-soc2 li#Button3 a {background-position: -787px 0px;height: 51px; width: 204px; margin-bottom:15px;}
#head-soc2 li#Button3 a:hover {background-position: -787px -51px;height: 51px; width: 204px}
#head-soc2 li#Button4 a {background-position: -787px 0px;height: 51px; width: 204px; margin-bottom:15px;}
#head-soc2 li#Button4 a:hover {background-position: -787px -51px;height: 51px; width: 204px}
#head-soc2 li#Button5 a {background-position: -787px -102px;height: 51px; width: 204px; margin-bottom:15px;}
#head-soc2 li#Button5 a:hover {background-position: -787px -102px;height: 51px; width: 204px}
,如果它幫助這裏是一個的jsfiddle :) http://jsfiddle.net/8xZDL/
謝謝!
@codehorse這個問題確實有無關精靈,除了這對實現背景圖像OP的策略。這更好地描述爲「爲什麼我的文本沒有出現在這些按鈕中」;答案是,字體大小設置爲0,文本縮進9999px離開屏幕。 –