通过css替换图像 [英] replace image through css

查看:173
本文介绍了通过css替换图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Stylish,一个firefox插件中编写代码,以更改正在显示的图片。

I'm writing code in Stylish, a firefox plugin, to change the image that is showing up.

image属性没有div标签,所以我必须使用这个:

The image property doesn't have a div tag, so I have to use this:

img[src*="s_dschjungelplanet"]{
##########
}

因此,这将取代s_dschjungelplanet ,in a img src。

So this will replace "s_dschjungelplanet" anywhere in the page, in a img src.

所以我的主要问题是,我不知道如何告诉它替换src =xxx。

So my main problem is that I'm not sure HOW to tell it to replace the src="xxx".

Ta回复

推荐答案

没有简单的方法。我想你会更好的greasemonkey脚本,作为一个简单的这样的脚本,你可以更改url。

There is no easy way. I think you'd be better of with greasemonkey scripts, as with a simple such script you can change the url.

据我所知,你不能改变url只有css。这是我能够与css只有最接近的:

As far as I know, you can not change the url with css only. This was the closest I was able to come with css only:

img[src*="s_dschjungelplanet"]{
    width:0;
    height:70px;
    padding-right:250px;
    background:transparent url(http://i.stackoverflow.com/Content/Img/stackoverflow-logo-250.png) top left no-repeat;
}

这篇关于通过css替换图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆