[英]Issue with making an overlay hover effect to a PNG image (transparent) in a parent div with a background color
這里是解決方案,不多說,但是數值需要相應地改變,我剛剛用數值來顯示function。 閱讀代碼的注釋
.parent { background-color: #000000; }.parent img:hover { opacity: .1; /*change this accordingly*/ background: rgba(255,255,255,0.5); /*Last value of rgba is opacity, 0.0 -> 1.0*/ }.parent img { background: rgba(255,255,255,1);; }
<div class="parent"> <img src="https://www.lunapic.com/editor/premade/transparent.gif"/> </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.