SVG symbol元素用法详解

SVG <symbol>元素定义可重复使用的符号。除非被<use>元素引用, 否则嵌套在<symbol>内的形状不会显示在屏幕上。

例子

<!DOCTYPE html>
<html>
   <body>

<svg width="450" height="450">
    <symbol id="shape1">
        <circle cx="40" cy="40" r="40" />
    </symbol>

    <use xlink:href="#shape1" x="50" y="30" />
</svg>

</body>
</html>

立即测试

解释

  • <symbol>的id属性定义了符号的唯一名称。
  • id属性是<symbol>元素所必需的, 因此以后可以由<use>元素引用。
微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_46673.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?