I have a weird issue using background-position
.. Simply it's not working !
Here's my code :
<div id="follow-wrapper">
<p>Follow Us</p>
<ul>
<li><a href="#" id="facebook-img"></a></li>
<li><a href="#" id="twitter-img"></a></li>
<li><a href="#" id="googlplus-img"></a></li>
<li><a href="#" id="linkedin-img"></a></li>
<li><a href="#" id="youtube-img"></a></li>
<li><a href="#" id="rss-img"></a></li>
</ul>
</div>
#follow-wrapper ul li {
display: inline-block;
margin-left:8px;
width: 16px;
height: 16px;
background-image: url('../img/follow.png');
background-repeat: no-repeat;
}
#facebook-img{
background-position: 0px 0px;
}
#twitter-img {
background-position: 0px -26px;
}
#googleplus-img{
background-position: 0px -52px;
}
#linkedin-img{
background-position: 0px -78px;
}
#youtube-img{
background-position: 0px -104px;
}
#rss-img{
background-position: 0px -130px;
}
And here's the result :
Put the ids on the li
tags instead of the anchors. Currently the li
tag receives part of the necessary styling such as width
, background-image
, etc... While the anchor tag receives the other piece of the styling, the background positioning. All of these styles should be applied to the li
.
<div id="follow-wrapper">
<p>Follow Us</p>
<ul>
<li id="facebook-img"><a href="#" ></a></li>
<li id="twitter-img"><a href="#" ></a></li>
<li id="googlplus-img"><a href="#"></a></li>
<li id="linkedin-img"><a href="#"></a></li>
<li id="youtube-img"><a href="#"></a></li>
<li id="rss-img"><a href="#"></a></li>
</ul>
</div>