CSS: image link, change on hover

前端 未结 8 2176
故里飘歌
故里飘歌 2020-11-29 17:48

I have an image that is a link. I want to show a different image when the user hovers over the link.

Currently I\'m using this code:



        
8条回答
  •  借酒劲吻你
    2020-11-29 18:32

     
    

    use a class for the link itself and forget the div

    .twitterbird {
     margin-bottom: 10px;
     width: 160px;
     height:160px;
     display:block;
     background:transparent url('twitterbird.png') center top no-repeat;
    }
    
    .twitterbird:hover {
       background-image: url('twitterbird_hover.png');
    }
    

提交回复
热议问题