我在容器中有两个元素。我希望当悬停时,第一个边框变为黄色,当悬停第二个时,第一个边框变为黄色。
这是我的代码:
input[type="checkbox"] {
display: none;
}
input[type="checkbox"]+label {
background: url('images/delete.png') no-repeat;
height:17px;
}
input[type="checkbox"]:checked + label {
background: url('images/delete.png') no-repeat;
height:17px;
}
我做了一个例子http://jsfiddle.net/df5dwsq8/
我不知道为什么这不起作用。如果有人能帮助我,我会很感激。
答案 0 :(得分:0)
<强> CSS:强>
.href1, .href2
{
display:block;
width:100px;
height:100px;
}
.href1
{
background:red;
border:2px solid #000;
margin-bottom:30px;
}
.href1:hover
{
border-color:yellow;
}
.href2
{
background:blue;
border:2px solid #000;
}
.href2:hover
{
border-color:yellow;
}