【问题标题】:CSS - Background position not working in Firefox [duplicate]CSS - 背景位置在 Firefox 中不起作用 [重复]
【发布时间】: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


【解决方案1】:

您使用的非标准 CSS 属性适用于 Chrome,但不适用于 Firefox。

见:Is background-position-x (background-position-y) a standard W3C CSS property?

但是,标准的背景属性会解决这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-27
    • 1970-01-01
    • 1970-01-01
    • 2016-09-14
    • 2016-09-22
    相关资源
    最近更新 更多