css - 背景 - 单斜条纹
问题描述
我需要有一个带有 CSS 的背景作为附加的图像我不能让它与线性渐变一起使用。
我正在尝试以下操作,但无法仅创建 1 个白色条纹。
div {
background: #5cbcb0;
background: linear-gradient(120deg, #5cbcb0 10%, #ffffff 10%, #ffffff 27%, #5cbcb0 27%, #5cbcb0 50%, #5cbcb0 50%, #5cbcb0 74.81%, #ffffff 73.81%, #ffffff 76.19%, #5cbcb0 76.19%, #5cbcb0 100%);
background-size: 593.97px 593.97px;
}
<div style="height: 200px;"></div>
解决方案
您只需要为颜色提供正确start
的stop
值。多条白色条纹的出现是由于之后使用的多个#fff
值73.81%
。
div {
background: linear-gradient(135deg, #5cbcb0 5%, #ffffff 5%, #ffffff 15%, #5cbcb0 15%);
/* Start #5cbcb0 from 0 and end at 5%, Start #fff at 5% and end at 15%, Start #5cbcb0 again at 15% and end at 100% */
background-size: 593.97px 593.97px;
background-repeat: no-repeat; /* To avoid multiple instances */
}
<div style="height: 200px;"></div>
推荐阅读
- c - Makefile给出重复错误C
- javascript - 如何从json stringify数组中获取所需的输出
- php - 在 WHMCS 的 register.php 中获取插入的 id
- ios - 具有本地化功能的设备上的 visualEffectView 更暗
- r - 从 geom_smooth() 中提取多条趋势线的斜率
- mysql - 如何在 SQL 表列中获取 N 个间隙?
- ubuntu - NVIDIA Jetson 无法识别 EasyCap USB 摄像头
- python - 同时生成生成器和上下文管理器
- android - 使用 Firebase Auth 获取空指针异常。已更新依赖项。降级了,还是不行
- reactjs - 如何在不使用任何额外 css 文件的情况下使用引导程序以及如何应用类名?