【发布时间】:2013-08-25 23:30:41
【问题描述】:
我有这个网站:http://seasonsrestaurant.ca/
在 Firefox 中,我的社交媒体图标都是 twitter 图标。这是我的 CSS。为什么后台位置不起作用?
ul.social-media li.twitter{
background-image:url(http://www.seasonsrestaurant.ca/images/social.png);
background-position-x:0px;
width:25px;
height:26px;
}
ul.social-media li.instagram{
background-image:url(http://www.seasonsrestaurant.ca/images/social.png);
background-position-x:-26px;
width:25px;
height:26px;
}
ul.social-media li.facebook{
background-image:url(http://www.seasonsrestaurant.ca/images/social.png);
background-position-x:-52px;
width:25px;
height:26px;
}
【问题讨论】:
-
你想要达到的效果是什么?这可能是一个更有成效的问题。
-
@Alfie OP 将所有社交媒体图标放在一个图像文件中,像精灵一样有规律地间隔。要查看选择的图标,只需使用(在本例中为 26px)按网格移动图像。
标签: html css background background-position