1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 关于如何用 CSS 实现不同类型波浪线

关于如何用 CSS 实现不同类型波浪线

时间:2021-11-30 17:44:32

相关推荐

关于如何用 CSS 实现不同类型波浪线

1. 样式一

<div class="box"><div class="wave"></div></div>

.box {position: relative;width: 800px;height: 30px;margin: 100px auto;background-color: #0f0;}.wave {position: absolute;left: 0;top: -5px;width: 100%;height: 20px;background: radial-gradient(circle, #0f0 10px, #0f0, transparent 10px, transparent);background-repeat: repeat-x;background-size: 18px 20px;}

2. 样式二

<div class="box"><div class="wave"></div></div>

.box {position: relative;width: 900px;height: 30px;margin: 100px auto;background-color: #0f0;}.wave {position: absolute;left: 0;top: -9px;width: 100%;height: 20px;background: radial-gradient(circle, #0f0 10px, #0f0, transparent 10px, transparent);background-repeat: repeat-x;background-size: 30px 20px;}

3. 样式三

<div class="box"><div class="wave"></div></div>

.box {position: relative;width: 900px;height: 30px;margin: 100px auto;overflow: hidden;}.aux-line {position: absolute;left: 0;top: -20px;width: 100%;height: 40px;background: radial-gradient(circle, transparent 10px, transparent, #f00 10px, #f00);background-repeat: repeat-x;background-size: 30px 30px;background-position: 0 0;}

4. 样式四

<div class="box"><div class="wave"></div><div class="aux-line"></div></div>

.box {position: relative;width: 900px;height: 30px;margin: 100px auto;background-color: #0f0;}.wave {position: absolute;left: 0;top: -5px;width: 100%;height: 20px;background: radial-gradient(circle, #0f0 10px, #0f0, transparent 10px, transparent);background-repeat: repeat-x;background-size: 30px 20px;}.aux-line {position: absolute;left: 0;top: -18px;width: 100%;height: 20px;background: radial-gradient(circle, #fff 10px, #fff, transparent 10px, transparent);background-repeat: repeat-x;background-size: 30px 20px;background-position: 15px 0;}

5. 样式五

<div class="box"><div class="wave"></div><div class="aux-line"></div></div>

.box {position: relative;width: 900px;height: 30px;margin: 100px auto;}.wave {position: absolute;left: 0;top: 0;width: 100%;height: 20px;background: linear-gradient(45deg, transparent 45%, #0f0 55%, transparent 55%);background-repeat: repeat-x;background-size: 39px 20px;background-position: 10px 0;}.aux-line {position: absolute;left: 0;top: 0;width: 100%;height: 20px;background: linear-gradient(135deg, transparent 45%, #0f0 55%, transparent 55%);background-repeat: repeat-x;background-size: 39px 20px;background-position: 30px 0;}

6. 样式六

<div class="test"></div><div class="test1"></div>

body {background: linear-gradient(90deg, #0ff, #ccc);}.test {width: 800px;height: 200px;background: radial-gradient(circle, transparent 30px, transparent, #0f0 30px, #0f0);background-size: 100px 100px;background-repeat: repeat-x;}.test1 {width: 800px;height: 200px;background: radial-gradient(circle, #0f0 30px, #0f0, transparent 30px, transparent);background-size: 100px 100px;background-repeat: repeat-x;}

如有错误,欢迎指正,谢谢!

以上内容仅供参考,欢迎大家讨论。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。