老师,请问为什么之前写的不需要考虑兼容性,而这次的作业必须写上前缀才行呢?
来源:3-17 编程练习
慕勒8522502
2019-06-13 00:02:37
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>径向渐变</title> <style type="text/css"> div{ width:200px;height:300px; float:left; margin:100px 0 0 100px; } /*补充代码,分别写出4个元素的背景渐变效果*/ .div1{ background:-webkit-radial-gradient(60% 40%, closest-side circle, red, yellow, green, blue); background: -moz-radial-gradient(60% 40%, closest-side circle, red, yellow, green, blue); background: -o-radial-gradient(60% 40%, closest-side circle, red, yellow, green, blue); background: radial-gradient(60% 40%, closest-side circle, red, yellow, green, blue); } .div2{ background:-webkit-radial-gradient(60% 40%, farthest-side circle, red, yellow, green, blue); background: -moz-radial-gradient(60% 40%, farthest-side circle, red, yellow, green, blue); background: -o-radial-gradient(60% 40%, farthest-side circle, red, yellow, green, blue); background: radial-gradient(60% 40%, farthest-side circle, red, yellow, green, blue); } .div3{ background:-webkit-radial-gradient(60% 40%, closest-corner circle, red, yellow, green, blue); background: -moz-radial-gradient(60% 40%, closest-corner circle, red, yellow, green, blue); background: -o-radial-gradient(60% 40%, closest-corner circle, red, yellow, green, blue); background: radial-gradient(60% 40%, closest-corner circle, red, yellow, green, blue); } .div4{ background:-webkit-radial-gradient(60% 40%, farthest-corner circle, red, yellow, green, blue); background: -moz-radial-gradient(60% 40%, farthest-corner circle, red, yellow, green, blue); background: -o-radial-gradient(60% 40%, farthest-corner circle, red, yellow, green, blue); background: radial-gradient(60% 40%, farthest-corner circle, red, yellow, green, blue); } </style> </head> <body> <div class="div1"></div> <div class="div2"></div> <div class="div3"></div> <div class="div4"></div> </body> </html>
1回答
你好,径向渐变是需要添加兼容前缀才能够显示出来的哦,所以需要添加上。
线性渐变linear-gradient,部分主流浏览器是不需要添加前缀的哦。
代码实现效果没有问题,很棒!
祝学习愉快!
相似问题