2016-04-03 37 views
0

我正要通過MDN HERE對文本錨點的屬性的文件,並且有這個很好的例子如下:文本錨覆蓋了x的值嗎?

 <!-- 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> 

上面的例子確實告訴我們如何該屬性可以使用FIDDLE HERE,我的問題是,屬性x已經給文本元素在軸上的特定定位,所以是text-anchor rea凌駕於x的價值?那是我唯一的問題。

回答

1

不,text-anchor不會覆蓋x屬性,它說位置是否不x給出y實際上是左下,中間或右下角加時賽文本被定位補充它。