请老师检查一下,谢谢。
来源:2-7 编程练习
努力的刘同学
2020-02-24 17:36:10
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>背景定位</title>
<style>
div{
width: 600px;
height: 300px;
margin: 0 auto;
border: 30px solid rgb(100, 255, 255, .3);
background: url(http://img1.sycdn.imooc.com\/climg/582c342b0001fd6507000210.jpg)no-repeat;
background-size:cover;
background-clip: content-box;
}
div:hover{
background: url(http://img1.sycdn.imooc.com\/climg/582c34220001091605000150.jpg)no-repeat ;
background-size:cover;
background-clip: border-box;
background-origin: content-box;
background-position: 10px 10px;
}
</style>
</head>
<body>
<div></div>
</body>
</html>1回答
同学你好,当打开页面时,背景图片区域绘制到内边距框。建议修改如下:

如果我的回答帮到了你,欢迎采纳,祝学习愉快~
相似问题