老师帮忙检查下
来源:2-7 编程练习
慕用6004130
2020-02-20 14:10:50
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>background-origin</title>
<style style="type/css">
*{
padding:0;
margin:0;
}
div{
width:200px;
height:100px;
padding:20px;
border:20px solid transparent;
background:url(http://climg.mukewang.com/582c342b0001fd6507000210.jpg) repeat ;
background-clip:padding-box;
}
span{
width:200px;
height:100px;
padding:20px;
position:absolute;
top:0px;
left:0px;
border:20px solid rgba(1,2,3,0.2);
}
div:hover{
background:url(http://climg.mukewang.com/582c34220001091605000150.jpg) no-repeat 10px 10px;
background-clip:border-box;
background-origin:content-box;
}
</style>
</head>
<body>
<div>
<span>
</span>
</div>
</body>
</html>
1回答
同学你好,效果是正确的,代码可以简化一下,去掉span元素,透明边框设置在div元素上。


代码中还有点问题,如下:

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