image - 悬停时的 SVG 图像
问题描述
我有一个我正在处理的项目的 SVG 图像。现在我想改变悬停时的颜色。我让中间人在 Hover 上工作。我的问题是如何将轮廓线悬停。
<svg width="108" height="108" viewBox="0 0 108 108" fill="#ffffff" xmlns="http://www.w3.org/2000/svg"><circle cx="54" cy="54" r="53" stroke="#1B1D27" stroke-width="2"/><path id="hover-style-svg"d="M30 60L54.1228 48L78.5 60" stroke="#1B1D27" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>
解决方案
尝试代码片段,看看这是否是您正在寻找的,因为问题太模糊了。
svg:hover * {
fill: black;
stroke: red;
}
<svg width="108" height="108" viewBox="0 0 108 108" fill="#ffffff" xmlns="http://www.w3.org/2000/svg" onclick="alert('You have clicked on svg')">
<circle cx="54" cy="54" r="53" stroke="#1B1D27" stroke-width="2" />
<path id="hover-style-svg" d="M30 60L54.1228 48L78.5 60" stroke="#1B1D27" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" />
</svg>
推荐阅读
- css - CSS。三列,外面的两列可变宽度但包裹着它们的内容,中间展开以填充可用的水平空间
- python - 在正则表达式中,如何匹配字符串的两种不同情况
- python - 从 Python 中不断更新的文件中读取整个文件数据
- python - 基于多个值条件打印字典键
- gnome - gnome-terminal:“--name”参数仅适用于第一个窗口
- mysql - 插入触发器之前的MYSQL:无法更新存储函数/触发器中的表,因为它已经在使用中
- ajax - 如何在 Laravel 中使用 Ajax?
- django - 如何为Django中尚不存在的表设置外键属性的默认值?
- android - 没有应用程序正在启动或运行
- c - 还有其他类型的控制台事件吗?