我想在半透明div元素上使用背景圖像,其中懸停在任何一個更改背景顏色。但是,將鼠標移至任一元素上時,我遇到了閃爍效果。懸停css時閃爍的顏色
<div class="container">
<div class="test"></div>
<div class="first box"></div>
<div class="third box">third</div>
<div class="second box">second</div>
<div class="fourth box">fourth</div>
<div class="last box">last</div>
</div>
CSS:
html, body,
.container {
height: 100%;
min-height: 100%;
}
.box {
width: 191px;
height: 145px;
margin: 4px;
float: left;
background-color: black;
}
.box:hover{
background-color:#EF6939;
opacity: 1;
overflow: hidden;
}
.test:hover{
background-color:#EF6939;
overflow: hidden;
}
.test {
width: 191px;
height: 145px;
margin: 4px;
float: left;
position: absolute;
/* background-image: url(test.png);*/
}
.first {
/* float: left; */
/* background-color: red; */
opacity: 0.1;
}
.second{
/* float: left;*/
/* background-color: green; */
}
.third{
/* float: right; */
/* background-color: blue; */
}
.fourth {
/* float: right; */
/* background-color: #DDDDDD; */
}
.last{
/* float: right; */
/* background-color: yellow; */
}
這裏是我的代碼的鏈接: http://jsfiddle.net/YTDyL/
什麼用途div.test服務?問題是它的重疊div.first,因爲它的位置絕對。可能需要在div.first中移動div.test(反之亦然)。兩個元素都在競爭:懸停,因爲它們重疊。 http://jsfiddle.net/YTDyL/1/ –
你應該把它作爲答案 – user2067005
你應該把它作爲答案 –