如何使圆形渐变边框成为按钮而不是正方形?

时间:2019-05-25 09:31:20

标签: css css3 linear-gradients

请问有人指导我如何使线性渐变css边框变为圆形而不是正方形,以支持所有浏览器?同样,按钮背景色最好是透明的。

.btn_outter { 
  border: 2px solid;
  border-image-source: linear-gradient(45deg, #FFF000, #000000);
  border-image-slice: 1;
  color: #000; 
}

1 个答案:

答案 0 :(得分:-1)

您可以尝试以下示例

 <!DOCTYPE html>
<html>
<head>
<style>

.btn_outter { 
  border: 20px solid;
  border-image-source: radial-gradient(red, green, blue);
  border-image-slice: 20;
  color: #000; 
}
.round_div{
    border: 1px solid;
    width: max-content;
    border-radius: 30px;
    overflow: hidden;
}

</style>
</head>
<body>
<div class="round_div">
<button class="btn_outter"> button </button>
</div>
<p><strong>Note:</strong> Internet Explorer 9 and earlier versions do not support gradients.</p>
</body>
</html>