请老师检查,对吗?
来源:3-2 编程练习
如花慕少
2020-01-12 22:47:56
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>线性渐变</title>
<style type="text/css">
/*此处写代码*/
div{
float:left;
margin:0 15px;
}
p{
font-size:16px;
text-align:center;
}
.div1{
width:120px;
height:120px;
background:linear-gradient(yellow,red);
}
.div2{
width:120px;
height:120px;
-webkit- background:linear-gradient(left, bottom yellow,red);
-moz- background:linear-gradient(right, yellow,red);
-o- background:linear-gradient(right, yellow,red);
background:linear-gradient(to right, yellow,red);
}
.div3{
width:120px;
height:120px;
-webkit- background:linear-gradient(right bottom, yellow,red);
-moz- background:linear-gradient(left top, yellow,red);
-o- background:linear-gradient(left top, yellow,red);
background:linear-gradient(to left top, yellow,red);
}
</style>
</head>
<body>
<!--此处写代码-->
<div>
<p>上下方向渐变</p>
<div class="div1"></div>
</div>
<div>
<p>左右方向渐变</p>
<div class="div2"></div>
</div>
<div>
<p>对角方向渐变</p>
<div class="div3"></div>
</div>
</html>
2回答
同学你好,代码是正确的,继续加油,祝学习愉快~
如花慕少
提问者
2020-01-12
上面的写错了,请老师检查这个:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>线性渐变</title>
<style type="text/css">
/*此处写代码*/
div{
float:left;
margin:0 15px;
}
p{
font-size:16px;
text-align:center;
}
.div1{
width:120px;
height:120px;
background:linear-gradient(yellow,red);
}
.div2{
width:120px;
height:120px;
background:-webkit-linear-gradient(left, bottom yellow,red);
background: -moz-linear-gradient(right, yellow,red);
background: -o-linear-gradient(right, yellow,red);
background: linear-gradient(to right, yellow,red);
}
.div3{
width:120px;
height:120px;
background:-webkit-linear-gradient(right bottom, yellow,red);
background: -moz-linear-gradient(left top, yellow,red);
background: -o-linear-gradient(left top, yellow,red);
background: linear-gradient(to left top, yellow,red);
}
</style>
</head>
<body>
<!--此处写代码-->
<div>
<p>上下方向渐变</p>
<div class="div1"></div>
</div>
<div>
<p>左右方向渐变</p>
<div class="div2"></div>
</div>
<div>
<p>对角方向渐变</p>
<div class="div3"></div>
</div>
</html>
相似问题