正如问题所问 - 我正在尝试弄清楚是否可以对 SVG 路径的笔划使用某种图案或重复的背景图像。
这可行吗?还是仅限于颜色?
TIA!
最佳答案
您可以使用 <pattern>
作为中风,例如
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<pattern id="p1" patternUnits="userSpaceOnUse" width="32" height="32">
<image xlink:href="http://phrogz.net/tmp/alphaball-small.png" width="32" height="32" />
</pattern>
</defs>
<rect stroke-width="32" stroke="url(#p1)" width="200" height="200" fill="none"/>
</svg>
模式可以包含<svg>
绘图元素或(如此处)图像,或两者兼而有之。
关于css - 是否可以在 SVG 元素的笔划上使用背景图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16988156/