svg简单使用

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<svg width="500" height="500">
    <!--矩形-->
    <rect x="10" y="10" width="30" height="30" stroke="pink" fill="yellow" stroke-width="5" id="rect"></rect>
    <!--圆角矩形-->
    <rect x="60" y="10" rx="10" ry="10" width="30" height="30" stroke="red" fill="blue" stroke-width="5"></rect>
    <!--圆-->
    <circle cx="25" cy="75" r="20" stroke="blue" fill="gold" stroke-width="5"></circle>
    <!--椭圆-->
    <ellipse cx="75" cy="75" rx="20" ry="15" stroke="#00ADEE" fill="#A2DE26" stroke-width="5"></ellipse>
    <!--直线-->
    <line x1="10" x2="50" y1="110" y2="150" stroke="black" stroke-width="5"></line>
    <!--折线-->
    <polyline points="60 110,65 120,70 115,75 130,80 125,85 140" stroke="orange" stroke-width="5"></polyline>
    <!--多边形-->
    <polygon points="50 160,55 180,70 180,60 190,65 205,50 195,35 205,40 190,30 180,45 180" stroke="gold" fill="yellow" stroke-width="5"></polygon>
    <!--路径-->
    <path d="M20,230 Q40,205 60,230 T90 230" stroke="red" fill="none" stroke-width="5"></path>
</svg>
<script>
    var rect = document.getElementById("rect");
    rect.onclick = function () {
        this.style.width = 50;
        this.style.stroke = "blue";
    }
</script>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值