请老师检查 谢谢
来源:2-7 编程练习
慕UI4313976
2020-03-09 16:16:15
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8" />
<title>background-origin</title>
<style type="text/css">
div{
width: 300px;
height: 150px;
border: 10px solid #9e09f5;
background: url(http://climg.mukewang.com/582c342b0001fd6507000210.jpg) no-repeat;
background-clip: border-box;
}
div:hover{
background: url(http://climg.mukewang.com/582c34220001091605000150.jpg) no-repeat;
background-position-x: 10px;
background-position-y: 10px;
/* 老师这里的简写有有顺序格式吗? */
}
</style>
</head>
<body>
<div></div>
</body>
</html>1回答
同学你好,代码效果正确。background属性的值的书写顺序官方并没有强制标准的。
为了可读性以及CSS书写规范,可参考如下顺序去写:background-color,background-image,background-repeat,background-attachment,background-position。
其余三个background-size,background-origin,background-clip建议单独写。
如果帮助到了你 欢迎采纳 祝学习愉快~
相似问题