SVG onmouseover in CSS



我有一个使用CSS创建更改onmouseover按钮的问题。很长一段时间以来,我使用以下代码调用

<a href="../../../">
<img src="file-url" 
onmouseover="this.src='file-url'"
onmouseout="this.src='file-url'"
border="0" alt=""/></a>
</div>

是否可以使用svg字符串代替url?

提前感谢您抽出时间!!

Mitch

使用.svg作为背景图像。

<a class="link" href="../../../"></a>
a.link {
display: block;
width: width of your svg;
height: height of your svg;
background: url(path/to/your/svg);
}
a.link:hover {
background: url(path/to/your/hover/svg);
}

最新更新