我在尝试用CSS替换此图像时遇到问题,我无法访问html.
<img
width="64"
height="64"
border="0"
style="width: 64px; height: 64px;"
src="http://www.nitrografixx.com/2013/lock-icon.gif">
</img>
Run Code Online (Sandbox Code Playgroud)
我试过这个,虽然它将图像作为背景添加到当前图像,但它不会取代它.
img[src='http://www.nitrografixx.com/2013/lock-icon.gif'] {
background: url(http://www.nitrografixx.com/2013/lock_bg.jpg) center !important;
}
Run Code Online (Sandbox Code Playgroud)
试试这个
<style>
.className{
content:url("http://www.nitrografixx.com/2013/lock_bg.jpg");
}
</style>
<img class="className"/>
Run Code Online (Sandbox Code Playgroud)