css3 线性渐变和径向渐变示例附图

2022-10-18,,,,

线性渐变:ie6以下不兼容

径向渐变:只支持firefox、chrome和safari

复制代码代码如下:
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html" charset="utf-8" />
<title>background color</title>
<style type="text/css">
* {
marigin:0;
padding:0;
}
div{
margin-bottom:20px;
width:300px;
height:100px;
}
.linear{/*线性渐变样式*/
background-color: #1fa9f4; /* old browsers */
background-image: -moz-linear-gradient(top,#1fa9f4 0%, #001c4e 100%); /* ff3.6+ */
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1fa9f4), color-stop(100%,#001c4e)); /* chrome,safari4+ */
background-image: -o-linear-gradient(top,#1fa9f4 0%, #001c4e 100%); /* opera 11.10+ */
background-image: -ms-linear-gradient(top,#1fa9f4 0%, #001c4e 100%); /* ie10+ */
background-image: linear-gradient(to bottom,#1fa9f4 0%, #001c4e 100%); /* w3c */
filter: progid:dximagetransform.microsoft.gradient( startcolorstr='#1fa9f4', endcolorstr='#001c4e',gradienttype=0 ); /* ie6-8 */
}
.circle{/*径向渐变样式*/
background-color: #1fa9f4; /* other browsers*/
background-image:-moz-radial-gradient(center 80px 45deg, circle farthest-corner, #1fa9f4 0%, #001c4e 100%); /* ff3.6+ */
background-image: -webkit-gradient(radial,50% 100%,10,50% 50%,90,from(rgba(31,169,244,1)),to(rgba(0,28,78,1))); /* chrome,safari4+ */
}
</style>
</head>
<body>
<div class="linear">
</div>
<div class="circle">
</div>
</body>
</html>

效果图:

《css3 线性渐变和径向渐变示例附图.doc》

下载本文的Word格式文档,以方便收藏与打印。