css3渐变属性有哪些

html-css011

css3渐变属性有哪些,第1张

CSS3 定义了两种类型的渐变(gradients):

线性渐变(Linear Gradients)- 向下/向上/向左/向右/对角方向

语法:background-image: linear-gradient(direction, color-stop1, color-stop2, ...)

径向渐变(Radial Gradients)- 由它们的中心定义

语法:background-image: linear-gradient(angle, color-stop1, color-stop2)

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<style>标签中,输入css代码:

div {width: 200pxheight: 150pxbackground: linear-gradient(red, white)}

3、浏览器运行index.html页面,此时td中的div的背景颜色从红色到白色渐变。