我可以使用CSS设置<path>
元素的一些属性值。但是,我无法让Chrome识别样式表中的d
属性。尽管它接受它作为有效的CSS标识符,但我找不到可接受的值。是否可以通过style
设置路径数据?例如:
<svg width="100" height="100" viewBox="0 0 100 100">
<!-- Background -->
<rect width="100" height="100" fill="gray" fill-opacity="0.3" />
<!-- Red triangle -->
<path d="M 15 10 H 90 V 85 Z" style="stroke: red; fill: red; fill-opacity: 0.5;" />
<!-- Green triangle -->
<path style="d: M 10 15 V 90 H 85 Z; stroke: green; fill: green; fill-opacity: 0.5;" />
</svg>