我刚刚在文本锚点的属性上浏览了MDN HERE 的文档,并且有如下优秀示例:
for(i=0; i <numbers .length && i<oddNumbers.length; i++){
以上示例确实向我们展示了如何使用该属性 FIDDLE HERE ,我的问题是,属性data
已经为文本元素提供了特定的定位 <!-- Materialisation of anchors -->
<path d="M60,15 L60,110 M30,40 L90,40 M30,75 L90,75 M30,110 L90,110" stroke="grey" />
<!-- Anchors in action -->
<text text-anchor="start"
x="60" y="40">A</text>
<text text-anchor="middle"
x="60" y="75">A</text>
<text text-anchor="end"
x="60" y="110">A</text>
<!-- Materialisation of anchors -->
<circle cx="60" cy="40" r="3" fill="red" />
<circle cx="60" cy="75" r="3" fill="red" />
<circle cx="60" cy="110" r="3" fill="red" />
<style><![CDATA[
text{
font: bold 36px Verdana, Helvetica, Arial, sans-serif;
}
]]></style>
</svg>
轴,x
真的覆盖了x
的值吗?那是我唯一的问题。
答案 0 :(得分:1)
不,text-anchor
不会覆盖x
属性,通过说明x
和{y
给出的位置来补充 {1}}实际上是要定位的文本的左下角,中下角或右下角。