其他分享
首页 > 其他分享> > 设置border-image后border-radius不生效的问题解决

设置border-image后border-radius不生效的问题解决

作者:互联网

html代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>文档标题</title>
</head>
<body>
    <h1>我的第一个HTML页面</h1>
    <p>我的第一个段落。</p>
      <div class='div'>
  </div>
</body>
</html>

css代码


.div{
width:200px;
height:200px;
border:solid 10px ;
border-image:linear-gradient(45deg,gold,deeppink) 1;
border-radius:10px;
}

效果图:

 

可以看到我们设置的 border-radius:10px;   没有生效

border-radius:10px;

解决方法:给我们的css加上    clip-path: inset(0 round 10px);

.div{
  width:200px;
  height:200px;
  border:solid 10px ;
  border-image:linear-gradient(45deg,gold,deeppink) 1;
  clip-path: inset(0 round 10px);
}

解决后的效果图如下:  (完美解决)

 

标签:gold,image,radius,10px,border,200px
来源: https://www.cnblogs.com/anqiphp/p/16198604.html