【发布时间】:2018-09-25 15:52:01
【问题描述】:
现在我有六个浮动 div,每个都有一个图像作为背景。每个 div 上都有 4.5px 的边距,所以看起来像是有边框。 我想让它在悬停时以不同的颜色跟踪/填充 div 的“边框”。我怎么做?
<div id="one" >
</div>
<div id="two" >
</div>
<div id="three" >
</div>
<div id="four" >
</div>
<div id="five" >
</div>
<div id="six" >
</div>
这是css:
#one,#two,#three,#four,#five,#six{
max-height:400px;
background-color: grey;
margin:4.5px;
height:60vh;
width:417px;
max-width:417px;
float:left;
background-size: cover;
opacity:.9;
text-align:center;
}
#one{
background-image:url('../images/1.jpg');
}
#two{
background-image:url('../images/2.jpg');
}
#three{
background-image:url('../images/3.jpg');
}
#four{
background-image:url('../images/4.jpg');
}
#five{
background-image:url('../images/5.jpg');
}
#six{
background-image:url('../images/6.jpg');
}
#one:hover,#two:hover,#three:hover,#four:hover,#five:hover,#six:hover{
opacity:1;
box-shadow: 0 0 0 8px white;
}
【问题讨论】:
-
您要创建动画边框吗?
-
是的!我希望它是动画的
-
那么哪个答案最能解决您的问题?你还没有选择一个。
标签: javascript html css