我有以下 div 限制。
<div class="profile_outer>
<div class="profile"></div>
</div>
和下面的CSS
.profile_outer {
border: 2px solid #660000;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-border-radius: 5px;
}
.profile {
width: 198px;
height: 225px;
border: 1px solid #660000;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-border-radius: 5px;
z-index: 100;
}
.profile_outer:hover {
background-color: blue;
}
你可以在这里找到小提琴
两个 div 都没有背景,背景由某个父 div 上的图像确定。所以它们是透明的。
因此,在悬停时,我只想更改外部配置文件的背景。仅当我还使用更改内部 div 的背景颜色时才有效
.profile_outer:hover .profile {
display: block;
background : #fff; // but I do NOT want to change the background
}
我尝试了以下这些组合:
.profile_outer:hover .profile {
display: block;
background : none !important;
background-color:transparent;
}
谢谢你的帮助。