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?

enter image description here

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> 

link reference

hope helps..


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -