2017-04-04 47 views

回答

0

你需要具有所需顏色的父包裝,
和輸入:focus使它透明使用opacity

.imageWrapper{ 
 
    display: inline-block; 
 
    background: #0C6; 
 
} 
 

 
.imageWrapper input[type=image]{ 
 
    vertical-align: top; 
 
    transition: 0.3s; /* fade nicely :) */ 
 
} 
 

 
.imageWrapper input[type=image]:focus{ 
 
    opacity: 0; 
 
}
<span class="imageWrapper"> 
 
    <input type="image" src="//placehold.it/60x60/f00"> 
 
</span>