html - Change color of Icon-Image on :hover – what other ways are there? -
i have following problem , drives me crazy:
basicly have div-container background. background should change when hover (see pichture). png , instead of white should turn red.
what have done until now:
first: css sprite
thought best solution becuase div changes it's size (responsive) , icon not have fixed size not clean: had small offset on hovering. not sure why… mybe can fixed…
second: 2 separate images
but not option in case because need work inline styles. :hover ist not available inline style.
thrid: tried mask-box-image
was woderful solution… but firefox not support it.
does has idea how solve it?
give try
css
.icon-cont{ height:300px; width:300px; background-color: #ff0000; text-align:center; } .icon-cont:hover{ background-color: transparent; } .icon-cont:hover .icon, .icon-cont:hover .icon::before, .icon-cont:hover .icon::after { border-color:#ff0000; } .icon{ height:0px; border-bottom:2px solid #fff; width:60%; line-height:300px; position: relative; margin:auto; top:50%; } .icon::before{ content:""; position: absolute; top:0; bottom: 0; left:-30px; margin:auto; height:20px; width:20px; border:2px solid #fff; border-radius:50px; } .icon::after{ content:""; position: absolute; top:0; bottom: 0; right:-30px; margin:auto; height:20px; width:20px; border:2px solid #fff; border-radius:50px; }
html
<div class="icon-cont"> <div class="icon"></div> </div>
hope helps..
Comments
Post a Comment