我需要鼠標懸停的CSS代碼當你懸停圖像時,它將顯示1px的邊界顏色和在總div的rgba中的顏色不透明度,但不改變在h3標籤和之前的文本的不透明度。與此同時,在懸停文本之前和之後顏色將會像附圖一樣改變。雖然我在這裏,但我知道我的CSS代碼是錯誤的。 這裏是jsFiddle Demo懸停div rgba與背景圖像,而不改變文本顏色的不透明度
這裏分別是HTML和CSS代碼---
HTML:
<div class="service-single-box relax-massage">
<h3 class="service-title">Relax Massage</h3>
</div>
CSS:
.service-single-box {
cursor: default;
margin-top: 15px;
margin-bottom: 15px;
overflow: hidden;
position: relative;
text-align: center;
height: 136px;
}
.service-single-box:hover, .service-single-box:focus{
background-color:rgba(0,0,0,0.5);
border-top: 1px solid #ab9661;
border-left: 1px solid #ab9661;
border-bottom: 2px solid #ab9661;
border-right: 2px solid #ab9661;
cursor: default;
}
.service-single-box img:hover, .service-single-box img:focus{
background-color: #282318;
border: 1px solid #ab9661;
cursor: default;
background-color:rgba(0,0,0,0.5);
}
.relax-massage{
background-image: url("../images/services.png");
}
.relax-massage h3{
color:#fdfdfb;
text-transform: uppercase;
font-size: 16px;
font-weight: bold;
width: 170px;
padding-top: 20px;
}
.relax-massage h3:hover{
color:#a4905d;
}
.relax-massage h3:before {
width: 28%;
background: none repeat scroll 0 0 #fdfdfb;
border-top: 1px solid #fdfdfb;
content: "";
height: 5px;
top: 28px;
position: absolute;
}
請參閱網頁設計[這裏](http://www.shop4localdeals.com/massage/wp-content/uploads/2014/09/services.jpg) – user44690 2014-09-04 05:29:30
此代碼僅適用於changi以前的文字和h3的顏色。但是當我把整個div的懸停顏色放在rgba中時,它不起作用。當我將鼠標懸停在它上面時,你能否爲它提供任何解決方案?rgba顏色將會改變,而不會改變文本和h3的當前懸停顏色。只有不透明工作,但rrgba不起作用。 [fiddle here](http://jsfiddle.net/rubel01/0caj74dv/3/) – user44690 2014-09-04 16:07:12