Last active
January 22, 2021 18:38
-
-
Save albyr/c597f2afac867ab2040f to your computer and use it in GitHub Desktop.
How to add file-type icons to links with CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
For this to work you need to have already included FontAwesome (https://fortawesome.github.io/Font-Awesome/) in your <head>: | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> | |
*/ | |
a[href$=".pdf"]:after { | |
font-family: FontAwesome; | |
content: "\00a0\f1c1"; /* 00a0 is a non-breaking space, f1c1 is the pdf symbol */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment