【问题标题】:Parts of an SVG will not change color on hover?SVG 的某些部分在悬停时不会改变颜色?
【发布时间】:2014-06-19 19:46:14
【问题描述】:

我已经为 SVG 对象设置了一个简单的颜色更改悬停,但是,SVG 的中心部分在悬停时不会改变颜色,只有 SVG 的外部会发生变化。有什么建议或线索让整个 SVG 在悬停时改变颜色?

我还在这里设置了一个 CodePen:http://codepen.io/codebuddy/pen/HlmuE

提前感谢您的帮助!

【问题讨论】:

  • 我想改变外环和内箭头的颜色,用负空间。
  • 喜欢这个? codepen.io/anon/pen/Crkhm
  • 太棒了,是的!我将不得不看看你做了什么,所以我会解决这个问题。非常感谢您的帮助

标签: html css svg hover


【解决方案1】:

您可以给 polygon 箭头元素一个类 (.inner_arrow),然后使用以下内容:

Updated Example

.arrow, .arrow-group path,
.inner_arrow {
  transition: all 1s;
}
.arrow:hover .arrow-group path,
.arrow:hover .inner_arrow {
  fill: red;
}

【讨论】:

    猜你喜欢
    • 2023-01-10
    • 2018-12-30
    • 1970-01-01
    • 2015-01-29
    • 1970-01-01
    • 2018-03-16
    • 1970-01-01
    • 2021-12-23
    • 1970-01-01
    相关资源
    最近更新 更多