【发布时间】:2017-01-06 07:23:48
【问题描述】:
我想创建一个可以用颜色、背景图片和文字显示的svg气泡(有点像下图)。:
以下是我到目前为止所做的:
气泡.svg
<!DOCTYPE html>
<html>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="700" height="660">
<defs>
<pattern id="image" patternUnits="userSpaceOnUse" height="100" width="100">
<image x="0" y="0" height="100" width="100" xlink:href="C:\Users\i333320\Desktop\images.jpg" opacity="0.5"></image>
</pattern>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<circle id="Oval-1" fill="url(#image)" cx="50%" cy="50%" r="30%"/>
<text x="50%" y="50%" fill="blue" stroke="red" stroke-width="1" text- anchor="middle" dy=".3em">Hello</text>
</g>
</svg>
</body>
</html>
上面代码的输出是:
如何填充颜色并同时显示背景图像和颜色。 可以用 html-css 还是用 React 框架?
【问题讨论】: