04-渐变(Gradients)

background的8个属性

属性作用
[background-color]设置背景颜色
[background-image]设置一个元素的背景图像
[background-position]设置背景图像的起始位置
[background-size]设置背景图片大小
[background-repeat]设置如何平铺对象的 background-image 属性
[background-attachment]设置背景图像是否固定或者随着页面的其余部分滚动
[background-clip]设置指定背景绘制区域
[background-origin:content-box;]设置图片上下左右居中

background-image的渐变属性

1.语法(线性渐变)

background-image: linear-gradient(direction, color-stop1, color-stop2, …);
background-image: linear-gradient(方向, 颜色, 颜色, …);
重复线性渐变background-image: repeating-linear-gradient(角度,颜色,颜色,颜色);
方向默认从上到下,也可以从左到右,也可以对角;颜色可以同时设置多种

属性作用
从上往下background-image: linear-gradient(to bottom,red,blue);
从左往右background-image: linear-gradient(to right,red,blue);
对角渐变background-image: linear-gradient(to right bottom,red,blue);
多种颜色background-image: repeating-linear-gradient(to bottom,red,yellow,blue);
重复线性渐变background-image: repeating-linear-gradient(45deg,red,yellow 7%,blue 10%);

在这里插入图片描述
在这里插入图片描述

2.语法(径向渐变)

background-image: radial-gradient(shape size at position, start-color, …, last-color);
background-image: radial-gradient(形状 位置, 开始颜色, …, 结束颜色);
shape:有两个值-circle-ellipse(默认椭圆)
size:渐变的大小,即渐变到哪里停止,它有四个值。
closest-side:最近边; farthest-side:最远边;
closest-corner:最近角; farthest-corner:最远角;(不知道干啥的,可能用来调位置)

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值