Font Awesome Text-Decoration and Link Underline

By  on  

If I were to describe Font Awesome in a word, I think it would be...awesome.  The icon font library is massively helpful in using quality vector glyphs instead of  separate images.  I tend to use a lot of icons within links, as they help users to more quickly visually identify navigation.  One side effect of using icons within links is that the icons themselves now use the text-decoration of the link.  I really don't want icons underlined like the link -- it looks tacky.  Here's how I remove them!

The CSS

Using the root icon selector and :before, we can adjust the icon's display and text-decoration:

i[class^="icon-"]:before {
	display: inline-block;
	text-decoration: none;
}

Needing this snippet to avoid text-decoration is a recent change as Font Awesome originally used the above styles.  Keep this CSS code handy if you use Font Awesome!

Recent Features

  • By
    6 Things You Didn’t Know About Firefox OS

    Firefox OS is all over the tech news and for good reason:  Mozilla's finally given web developers the platform that they need to create apps the way they've been creating them for years -- with CSS, HTML, and JavaScript.  Firefox OS has been rapidly improving...

  • By
    CSS Filters

    CSS filter support recently landed within WebKit nightlies. CSS filters provide a method for modifying the rendering of a basic DOM element, image, or video. CSS filters allow for blurring, warping, and modifying the color intensity of elements. Let's have...

Incredible Demos

  • By
    Create Your Own Dijit CSS Theme with LESS CSS

    The Dojo Toolkit seems to just get better and better.  One of the new additions in Dojo 1.6 was the use of LESS CSS to create Dijit themes.  The move to using LESS is a brilliant one because it makes creating your own Dijit theme...

  • By
    Introducing MooTools LinkAlert

    One of my favorite Firefox plugins is called LinkAlert. LinkAlert shows the user an icon when they hover over a special link, like a link to a Microsoft Word DOC or a PDF file. I love that warning because I hate the surprise...

Discussion

  1. Thanks for the snippet, I had the same issue and got to the same solution but was concerned about its performance.

    Anything you can say on this matter?

    • I can’t imagine this causing performance issues…

  2. Mircea

    Performance issues?

    p { color: #fff; } – my eight-core cpu is going full-load when renders this!

    WHAT A TWIST!

  3. Brandon

    Thanks for the tip. Here’s another similar service that’s amazing as well: http://icomoon.io/

  4. Does this still fix IE10? It’s broken for me. :(

  5. Stephen you might need to use

    i[class^="fa"]:before {
  6. Ah thanks! That one was driving me nuts. Didn’t think to try inline-block – i’ll get some more sleep tonight thanks to you :)

  7. nonsaprei

    Thanks, this trick worked for me even in 2020 with Font Awesome 5.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!