在附加的代码片段中,我有一个多边形,我需要添加一个效果,使它看起来像这样: 我不知道如何在svg中实现这一点,如果是html我想我会使用box-shadow。唯一似乎可行的解决方案是使用filter,但我认为我只能在
<svg/>
元素上使用它,所以我很困惑该怎么做。
polygon {
fill: #5091b9;
stroke: #4387b0;
stroke-width: 2;
}
<svg width="300" height="300">
<g transform="translate(100, 100)">
<polygon points="25.98076211353316,-14.999999999999998 25.98076211353316,14.999999999999998 1.83697019872103e-15,30 -25.98076211353316,14.999999999999998 -25.980762113533157,-15.000000000000004 -5.510910596163089e-15,-30" class="node-vertical__hexagon node-vertical__inactive"> </polygon>
</g>
</svg>
defs
的独立SVG文件,并通过use xlink:href
应用它们。 - Chris W.标签,您可以通过CSS的
url()函数来引用它们。如果在
<svg>元素本身上使用它们,甚至可能会出现[意外问题](https://stackoverflow.com/questions/51295274),特别是与
viewBox`结合使用时。 - ccprog