<span class="stMainServices st-facebook-counter" style="background-image: url(http://w.sharethis.com/images/facebook_counter.png);"> <img src="http://w.sharethis.com/images/check-big.png" style="position: absolute; top: -7px; right: -7px; width: 19px; height: 19px; max-width: 19px; max-height: 19px; display: none;"></span>我不能用我自己的图像改变背景图像(facebook_counter)。我试着用.css(“背景图像”,"url...")来改变它。和.attr("style","new style"),但可能我用错了选择器部分。
我也是通过使用wordpress安装中的wp socializer获得这段代码的。谢谢
发布于 2012-12-20 05:14:27
这是因为CSS的优先级。内联样式(在标记中使用style="blah"声明)比样式表中的项目具有更高的优先级。
你可以在你的样式上用!important标志覆盖它,但是this is considered bad practice。
.st-facebook-counter
{
background-image: url('someotherimage.jpg') !important;
}发布于 2018-05-10 14:52:31
要更改背景图像,例如facebook:
默认情况下,sharethis的工作方式如下:
<span class="st_facebook"></span>我们需要将上面的更改为
<span class="st_facebook_custom"></span>然后将样式添加到类中:
.st_facebook_custom{
background: url("http://path/to/image/file") no-repeat scroll left top transparent;
padding:0px 16px 0 0;
} 它应该与您需要的图像完美配合。
https://stackoverflow.com/questions/13961256
复制相似问题