#02. 颜色,位置 linear-gradient(red 0 20%, blue 80% 100%) // 0 到20% 为红色,20% 到80% 为渐变过度,80% 到100% 为蓝色 background-image:linear-gradient(red20%,blue80%);// (颜色在前,位置在后)相当于:background-image:linear-gradient(red020%,blue80%100%);// 默认省略最前的0,与...
background: -webkit-radial-gradient(circle,red, yellow, green); /* Safari 5.1 - 6.0 */ background: -o-radial-gradient(circle,red, yellow, green); /* Opera 11.6 - 12.0 */ background: -moz-radial-gradient(circle,red, yellow, green); * Firefox 3.6 - 15 */ background: radial-gradien...
radial-gradient(100px at left top, white, deepskyblue); 1. 2. 渐变的中心点在距离右边缘和下边缘100px的位置 radial-gradient(100px at right 100px bottom 100px, white, deepskyblue); 1. 渐变终止点 radial-gradient(farthest-corner circle at right 100px bottom 100px, white, deepskyblue); 1. ...
实现思路很简单,利用线性渐变实现背景的黑色线条,通过位置控制线条的粗细。h2 { text-align:center; line-height:50px; background:linear-gradient( transparent 49%,#00049%,#00051% ,transparent 51%); span{ padding:010px; background:#fff; } } 发散思考 你之前的场景是如何实现...
background: linear-gradient(direction, color-stop1, color-stop2, ...); direction:默认为to bottom,即从上向下的渐变; stop:颜色的分布位置,默认均匀分布,例如有3个颜色,各个颜色的stop均为33.33%。 2.示例:to left、top right、to bottom、to top div { background:linear-gradient(to left, red , ...
基本语法linear-gradient(direction, color-stop1, color-stop2, ...);direction: 指定渐变的方向。可以是角度(如 45deg)或方向关键词(如 to left)。color-stop: 定义渐变中的颜色节点。每个颜色节点由颜色值和可选的停止位置组成。示例代码1. 基本线性渐变div {width: 200px;height: 200px;background-...
linear-gradient(180deg, #fff, #333); 第一个值 是角度的意思。 也就是从上渐变到下,一个圆是 360deg。 linear-gradient(to bottom, #fff 0px, #333 100px); 第二个值的 0px 和 第三个值的 100px 是, 从 第二个值的颜色,0px位置开始, 渐变到 第三个值的 100px位置停止。具体是怎么样的,...
linear-gradient设置颜色的起止位置 使用的核心API 颜色渐变 核心代码解释 在设置渐变的时候,一段是同一个颜色可以设这一段两个端点的颜色相同,比如0.3-0.6的颜色相同。如下代码所示: Row() .width('90%') .height(50) .linearGradient({...
从右下到左上、从蓝色渐变到红色 linear-gradient(to left top, blue, red); 从下到上,从蓝色开始渐变、到高度40%位置是绿色渐变开始、最后以红色结束 linear-gradient(0deg, blue, green 40%, red); 实例1: background: linear-gradient(#e66465, #9198e5); 效果如下: 实例2: p { width: 400px; ...