SVG在显示上的小bug

在HTML 中引入SVG,但是在页面中竟然不显示SVG???

我的 HTML 和 SVG 文件

<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <meta >
    <link rel='stylesheet' type='text/css' media='screen' href='main.css'>
    <script src='main.js'></script>
</head>
<body>
    <img src="circle.svg" alt="SVG image" />
</body>
</html>
<svg version="1.1">
    <circle cx="90" cy="90" r="40" fill="red" stroke="black" stroke-width="2"/>
</svg>

我想要的结果是
能够正常显示的svg
但是我的得到的结果是:
不能正常显示的图片

解决方法:svg 文件中添加命名空间 xmlns、xmlns:xlink、xmlns:svg等比如:

<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
    <circle cx="90" cy="90" r="40" fill="red" stroke="black" stroke-width="2"/>
</svg>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值