请教一下那个border:hover div?谢谢!
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>background-clip</title>
<style type="text/css">
.border,.padding,.content{/*给最外层的div设置样式*/
width:300px;height:300px;
float:left;margin-left:50px;
}
a{
text-decoration:none;
font-size:30px;
}
.div1,.div2,.div3{/*放置背景图片的div样式*/
width:220px;height:200px;
border:10px solid rgba(0,255,0,0.3);
padding:50px;
background-image:url("http://img1.sycdn.imooc.com/climg//582c316e0001fd6507000210.jpg");
margin-top:50px;
display: none;
}
.border:hover div,.padding:hover div,.content:hover div{
display:block;
}
/*补充代码*/
a:hover + .div1{
display: block;
background-clip: border-box;
}
a:hover + .div2{
display: block;
background-clip: padding-box;
}
a:hover + .div3{
display: block;
background-clip: content-box;
}
</style>
</head>
<body>
<div class="border">
<a href="">border-box</a>
<div class="div1"></div>
</div>
<div class="padding">
<a href="">padding-box</a>
<div class="div2"></div>
</div>
<div class="content">
<a href="">content-box</a>
<div class="div3"></div>
</div>
</body>
</html>0
收起
正在回答 回答被采纳积分+1
1回答

恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星