CSS颜色渐变的代码

*{
        padding:0px;
        margin:0px;

        }
        
#d1
{
        width:300px;
        height:200px;
        border:solid 1px red;
        /*颜色渐变  color是表示在0.4百分比的位置加颜色渐变色标,其他的自己读懂它*/
        background:-webkit-gradient(linear,left top, left bottom,from(blue),to(red),color-stop(0.4,#fff));
        }
        
#d2
{
        width:300px;
        height:200px;
        border:solid 1px red;
        /*颜色渐变 圆的渐变  同样也可以加色标*/
        background:-webkit-gradient(radial,center center, 0,center center,200,from(blue),to(red));
        }
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>练习</title>
<link href ="demo.css" type="text/css" rel="stylesheet" />

</head>

<body>
<div id="d1"></div>
<div id="d2"></div>
</body>
</html>

此处评论已关闭