Skip to content

Instantly share code, notes, and snippets.

@alpual
Created July 5, 2018 23:42
Show Gist options
  • Save alpual/13ccedc383f3b0c73186b80cae6eb6b4 to your computer and use it in GitHub Desktop.
Save alpual/13ccedc383f3b0c73186b80cae6eb6b4 to your computer and use it in GitHub Desktop.
FontAwesome Icon pseudoelements for file-types
/* link file type icons as pseudoelements */
a {
&::after{
font-family: "Font Awesome 5 Free";
font-weight: 600;
font-size: .75rem;
padding-left: .5em;
position: relative;
bottom: 2px;
}
/* external link icon */
&[href*="//"]:not([href*="127.0.0.1"])::after { /*change 127.0.0.1 to whatever your domain is */
content: '\f35d';
}
/* PDF */
&[href$=".pdf"]::after {
content: '\f1c1';
}
/* Word */
&[href$=".docx"]::after,
&[href$=".docm"]::after,
&[href$=".dotx"]::after,
&[href$=".dotm"]::after,
&[href$=".docb"]::after,
&[href$=".odt"]::after,
&[href$=".doc"]::after {
content: '\f1c2';
}
/* Excel */
&[href$=".xlsx"]::after,
&[href$=".xltx"]::after,
&[href$=".xltm"]::after,
&[href$=".xlsm"]::after {
content: '\f1c3';
}
/* Video */
&[href$=".avi"]::after,
&[href$=".mov"]::after,
&[href$=".qt"]::after,
&[href$=".wmv"]::after,
&[href$=".mpg"]::after,
&[href$=".mp4"]::after {
content: '\f1c8';
}
/* Powerpoint */
&[href$=".ppt"]::after,
&[href$=".ppm"]::after,
&[href$=".potx"]::after,
&[href$=".potm"]::after,
&[href$=".ppsx"]::after,
&[href$=".ppsm"]::after,
&[href$=".odp"]::after,
&[href$=".pptx"]::after {
content: '\f1c4';
}
/* Image File Type */
&[href$=".jpg"]::after,
&[href$=".gif"]::after,
&[href$=".tiff"]::after,
&[href$=".bmp"]::after,
&[href$=".jpeg"]::after,
&[href$=".png"]::after {
content: '\f1c5';
}
/* Archive */
&[href$=".zip"]::after,
&[href$=".tar"]::after,
&[href$=".bz2"]::after,
&[href$=".7z"]::after,
&[href$=".s7z"]::after,
&[href$=".rar"]::after,
&[href$=".tar.gz"]::after,
&[href$=".zipf"]::after {
content: '\f1c6';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment