【27前端】base标签带有href属性会让chrome里的svg元素url失效

一个chrome的问题,但具体原因不明。

触发条件:chrome浏览器base标签里href属性有值的时候

触发问题:svg里面的元素如果有用url的滤镜和模糊,则会失效,在firefox里和IE10没有发现这个问题。

正常状态:

有base标签且href里值为“.”的时候chrome里的状态:

 测试代码:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>chrome bug</title>
<style>
#svg{ width:500px; height:500px; display:block; margin:20px auto; background-color:#000; }
</style>
<!--当href=""里面有值的时候填写的url都会失效-->
<base href="." target="_blank">

<!--当href=""这样则不会-->
<!--<base target="_blank">-->
</head>

<body>
<svg id="svg">
	<defs>
		<lineargradient id="blur1" x1="0%" y1="0%" x2="100%" y2="0%">
		  <stop offset="0%" style="stop-color:#FF0000;stop-opacity:0"></stop>
		  <stop offset="100%" style="stop-color:#FF0000;stop-opacity:1"></stop>
		</lineargradient>
		<filter id="Gaussian_Blur">
			<feGaussianBlur in="SourceGraphic" stdDeviation="3" />
		</filter>
	</defs>
	
	<circle cx="200" cy="50" r="40" style="stroke:url(#blur1); filter:url(#Gaussian_Blur); stroke-width:10; fill:yellow; "/>
	<line x1="0" y1="0" x2="300" y2="300" style="stroke:url(#blur1); stroke-width:2;" />
</svg>
</body>
</html>

 

具体原因不明,希望有大神赐教。

 

转载于:https://www.cnblogs.com/css27/p/3873079.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值