Categories: SVG教程

SVG:link-链接

<a>元素用于创建超链接。“ xlink:href”属性用于传递与URI(统一资源标识符)互补的IRI(国际化资源标识符)。

说明

以下是<a>元素的语法声明。我们仅显示了主要属性。

<a
   xlink:show = "new" | "replace"
   xlink:actuate = "onRequest"
   xlink:href = "<IRI>"
   target = "_replace" | "_self" | "_parent" | "_top" | "_blank" | "<XML-Name>" >
</a>

属性

序号名称与说明
1个xlink:show-出于文档目的,用于支持XLink的处理器。默认为新。
2xlink:actuate-出于文档目的,用于支持XLink的处理器。
3xlink:href-被引用对象的位置。
4target-在可能使用最终资源的目标时使用。

<html>
   <title>SVG Linking</title>
   <body>
   
      <h1>Sample Link</h1>
      
      <svg width="800" height="800">
         <g>
            <a xlink:href="https://www.web176.com"> 
               <text x="0" y="15" fill="black" >
               Click me to load web176 DOT COM.</text>
            </a>
         </g> 
         
         <g>
            <text x="0" y="65" fill="black" >
            Click in the rectangle to load web176 DOT COM</text>
            
            <a xlink:href="https://www.web176.com"> 
               <rect x="100" y="80" width="300" height="100"
               style="fill:rgb(121,0,121);stroke-width:3;stroke:rgb(0,0,0)" /> 
            </a>
         </g>
      </svg>
   
   </body>
</html>

输出

在Chrome网络浏览器中打开textSVG.htm。您可以使用Chrome / Firefox / Opera直接查看SVG图像,而无需任何插件。Internet Explorer 9和更高版本还支持SVG图像呈现。单击链接和矩形以查看结果。

terry

这个人很懒,什么都没有留下~

Share
Published by
terry

Recent Posts