Is it possible to change between two fontawesome icons on hover?

后端 未结 6 1285
情书的邮戳
情书的邮戳 2020-12-05 00:52

I have an anchor tag with a font-awesome icon as follows


6条回答
  •  甜味超标
    2020-12-05 01:10

    You could toggle which one's shown on hover:

    HTML:
    
        
        
    
    
    CSS:
    .lock:hover .icon-unlock,
    .lock .icon-lock {
        display: none;
    }
    .lock:hover .icon-lock {
        display: inline;
    }
    

    Or, you could change the content of the icon-unlock class:

    .lock:hover .icon-unlock:before {
        content: "\f023";
    }
    

提交回复
热议问题