2016-08-24 57 views
-1


我想爲我的網站添加一個社交媒體圖標,並且漸變是在CSS3中。 當前,當鼠標懸停時,隱藏圖標輪廓。CSS Instagram徽標

這是我現在的代碼。我的Facebook徽標起作用,除了純色(background: #3b5998;)而不是漸變webkit以外,其他徽標完全相同。 Facebook的工作原理應該是這樣,當圖標變爲藍色時,圖標變成藍色,中間是「F」。

關於如何在這裏完成任何提示?謝謝!

.social-icons li.instagram a { 
      border-radius: 50%; 
      background: #F2F2F2 /* This is for the default "gray" background */ 
url(http://www.example.com/images/social/instagram.png) no-repeat 0 0; 
     } 
     .social-icons li.instagram a:hover { 
      background-color: #f09433; 
     background: -moz-linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); 
     background: -webkit-linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); 
     background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); 
     filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f09433', endColorstr='#bc1888',GradientType=1); 

     } 

回答

0

我意識到我的問題是,漸變被視爲是圖像,所以我做的是重疊兩個'圖像'來獲得所需的結果。

所以最終確定的代碼是:

.social-icons li.instagram a { 
    border-radius: 50%; 
    background: #F2F2F2 url(http://www.myprojectsite.com/images/social/instagram.png) no-repeat 0 0; 
} 
.social-icons li.instagram a:hover { 
    background-color: #f09433; 

    background-image: url('http://www.myprojectsite.com/images/social/instagram.png'), linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); 

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f09433', endColorstr='#bc1888',GradientType=1); 

background-image: url('http://www.myprojectsite.com/images/social/instagram.png'), -moz-linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); 

background-image: url('http://www.myprojectsite.com/images/social/instagram.png'), -webkit-linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); 
}