html - 将线性渐变语法转换为-webkit-渐变语法
问题描述
我正在尝试在该段落中添加行,但我无法将以下语法的线性渐变转换为 -webkit-gradient 语法,因为 wicked_pdf 不支持 rails 的线性渐变。
任何帮助,我无法在网上找到 -webkit-gradient 文档。
linear-gradient(180deg, rgba(230, 230, 231, 1) 1px, rgba(0, 0, 0, 0) 1px, rgba(0, 0, 0, 0) 100%);
解决方案
你这样做:
-webkit-gradient(<type>, <point> [, <radius>]?, <point> [, <radius>]? [, <stop>]*)
<type>
是线性的或径向的。
<point>
是一对以空格分隔的值。该语法支持点值的数字、百分比或关键字 top、bottom、left 和 right。
[, <radius>]?
是一个数字,仅在<type>
径向时使用。
<stop>
是一个函数, color-stop
, to
, 或from
. color-stop
接受 2 个参数:停止值(百分比或 0 到 1.0 之间的数字)和颜色(任何有效的 CSS 颜色)。to(color)
是 的等价物color-stop(0, color)
并且from(color)
是 的等价物color-stop(1.0, color)
。
例子:-webkit-gradient(linear, left top, left bottom, from(#00abeb), to(#fff), color-stop(0.5, #fff), color-stop(0.5, #66cc00))
你也可以使用-webkit-linear-gradient(angle, startColor, endColor)
例子:-webkit-linear-gradient(135deg, white, black)
您的具体示例将是这样的:
-webkit-linear-gradient(180deg, rgba(230, 230, 231, 1) 1px, rgba(0, 0, 0, 0) 1px, rgba(0, 0, 0, 0) 100%);
来源:
https ://webkit.org/blog/175/introducing-css-gradients/
https://webkit.org/blog/1424/css3-gradients/
推荐阅读
- airflow - Airflow 忽略 start_date 并立即安排任务
- swift - 如何从单例中的异步内容更新界面元素
- android - Lined EditText 底线消失
- git - 我可以检查我的任何项目中是否有任何更改尚未提交到他们的 Git 存储库
- docker - 在没有`docker pull`的情况下获取注册表中图像的Dockerfile
- mongodb - mongodb写入完全使用cpu但根本不使用内存
- c# - 我需要在 multiplyMatrixByConstant 方法中使用矩阵数组,但我不确定如何
- multithreading - 即使 main 函数终止,goroutines 是否会继续运行?
- node.js - 'npx create-react-app [name] --template typescript' 错误
- node.js - 在 NodeJS/Express 中将带有其他键值参数的图像上传到 postman