abd*_*hab 7 css border linear-gradients css3 repeating-linear-gradient
如何使用CSS创建以下彩虹效果?
即顶部圆形边框,固体彩虹色停止(不插入HTML).
颜色是:#c4e17f. #f7fdca, #fad071, #f0766b, #db9dbe, #c49cdf, #6599e2, #61c2e4
.
到目前为止我尝试了什么:
.container {
background: #596678;
width: 100%;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.top-round-rainbow {
width: 50%;
height: 50%;
background: white;
border-radius: 4px;
background-image: repeating-linear-gradient(to right, #c4e17f 50px, #f7fdca 50px, #fad071 50px, #f0766b, #db9dbe, #c49cdf, #6599e2, #61c2e4);
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
<div class="top-round-rainbow">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
你不是那么遥远.只需要设置相同值的颜色停止,使它们作为纯色,背景大小只在顶部.
.container {
background: #596678;
width: 100%;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.top-round-rainbow {
width: 400px;
height: 50%;
background: white;
border-radius: 4px;
background-image: repeating-linear-gradient(to right,
#c4e17f 0px, #c4e17f 50px,
#f7fdca 50px, #f7fdca 100px,
#fad071 100px, #fad071 150px,
#f0766b 150px, #f0766b 200px,
#db9dbe 200px, #db9dbe 250px,
#c49cdf 250px, #c49cdf 300px,
#6599e2 300px, #6599e2 350px,
#61c2e4 350px, #61c2e4 400px);
background-size: 100% 10px;
background-repeat:no-repeat;
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
<div class="top-round-rainbow">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3537 次 |
最近记录: |