一:线性渐变 属性--->linear-gradient
background-image: linear-gradient(circle , orange, green);
二:径向渐变 属性--->radial-gradient
background-image: radial-gradient(circle, orange, green);
两者都有repeating功能
效果:
index.html:
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>CSS3渐变效果</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div>我是HTML5</div>
</body>
</html>
style.css
@charset "utf-8";
div{
width: 500px;
height: 200px;
/*background-color: green;*/
/* background-image: linear-gradient( orange, green);
background-image: linear-gradient( to top right, orange, green);*/
/*角度0-360逆时针*/
/*background-image: linear-gradient(45deg, orange 0%, green ,blue,red 100%);*/
/*background-image: linear-gradient( -45deg, orange , green,blue 250px,red);*/
/*background-color: red;
background-image: linear-gradient(to top right,rgba(0,0,0,0.6),rgba(0,0,0,0));
*/
/*background-image: repeating-linear-gradient( orange 10px, green 30px);*/
/*background-image: radial-gradient(circle, orange, green);*/
/*background-image: radial-gradient(circle at top right, orange, green);*/
/*background-image: radial-gradient(circle closest-side, orange, green);*/
/*background-image: radial-gradient(circle , orange, green);*/
background-image: repeating-radial-gradient(circle 20px, orange, green);
}
ppt: