【发布时间】:2017-03-04 08:22:27
【问题描述】:
我有一个在 html 中加载的 svg,它看起来像这样:
<img src="assets/img/big_layout.svg" alt="Line Overview" class="line_overview">
实际的 svg 文件如下所示:
<svg x="0" y="0" width="1466" height="825" viewBox="0 0 1466 825" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
style="display: block;margin-left: auto;margin-right: auto;">
<defs>
<!-- SOME STYLES I've REMOVED -->
</defs>
<path fill-rule="evenodd" d="M0,0L1466,0l0,825L0,825L0,0Z" class="g1_1" />
<path fill-rule="evenodd" d="M0,0L1466,0l0,825L0,825L0,0Z" class="g1_1" />
<path fill-rule="evenodd" d="M187,21l195,0l0,195l-195,0L187,21Z"
// LOADS MORE PATHS!!!!
我希望能够从父 html 更改此 svg 中的一些样式,例如将fill: green 添加到.g1_1 类。这可能吗?
【问题讨论】:
-
这可能对您有帮助吗? stackoverflow.com/questions/10139460/…
标签: javascript html css svg