Strange underlines in font-awesome CSS

前端 未结 6 920
孤城傲影
孤城傲影 2021-01-03 20:38

When I hover on font-awesome\'s icons (when they\'re stacked together) like below (see picture). I get these strange underlines. Any idea where they could come from?

相关标签:
6条回答
  • 2021-01-03 21:00

    Those lines usually come from the default (underline) a element style.

    Either use another element or remove the underline :

    a.social { /* or whatever your class */
       text-decoration: none;
    }
    
    0 讨论(0)
  • 2021-01-03 21:00

    It may also be necessary to use the important keyword in your class definition

        text-decoration: none !important;
    
    0 讨论(0)
  • 2021-01-03 21:03

    Fontawesome great and fun. But if you are using it as font, this is expected behaviour.

    Add text-decoration to every state. If you don't add :link it will show purple underline, very hard to see but it is there.
    If you don't add :active it will show red underline when clicking, very visible.

    a:hover, a:focus, a:active, a:visited, a:link{
        text-decoration: none;
    }
    
    0 讨论(0)
  • 2021-01-03 21:09

    Assuming you are using a tags

    text-decoration: none;
    
    0 讨论(0)
  • 2021-01-03 21:13

    "text-decoration: none;" needs to be set with the ":hover" selector on the "a" tag, like this...

    a:hover {
        text-decoration: none;
    }
    
    0 讨论(0)
  • 2021-01-03 21:18

    Remove text-decoration for hover effect on all fa class objects:

    .fa:hover {
      text-decoration: none;
    }
    
    0 讨论(0)
提交回复
热议问题