本文介绍了插入SVG绘制一个矩形之间的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在SVG一个code:
I have a code in SVG:
<svg width="100%" height="100%" version="1.1"xmlns="http://www.w3.org/2000/svg">
<rect x="20" y="20" width="250" height="250" style="fill:blue">
<animate attributeType="CSS" attributeName="opacity" from="1" to="0" dur="5s" repeatCount="indefinite" />
</rect>
</svg>
现在我需要添加此长方形
之间的文本。谁能告诉我该怎么办呢?
Now I need to add a text between this rectangle
. Can anyone tell me how to do it?
推荐答案
我不知道你所说的中间的意思。如果你的意思是水平,垂直居中,那么这将做到这一点:
I am not sure what you mean by "between". If you mean "centered horizontally and vertically", then this would do it:
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="20" y="20" width="250" height="250" style="fill:blue" />
<text x="145" y="145" text-anchor="middle" alignment-baseline="middle">
Hello World
</text>
</svg>
你的意思是什么东西?
Did you mean something else?
如果你正在谈论有文字在矩形的边缘文本换行的矩形多行填充到一个新的阵容,那么你应该看到的
If you are talking about having text filling the rectangle—multiple lines of text wrapping at the edges of the rectangle onto a new line—then you should see this Stack Overflow question instead.
这篇关于插入SVG绘制一个矩形之间的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!