Hello,
In this post I would like to talk about how to add a filetype icon to a link. For example if I have a html tag with a link to a .pdf document I would like to show a PDF icon beside the link to inform the user that the link is a PDF document.
I have found out to do this by reading a section in a new book I have recently got my hands on, called CSS Mastery: Advanced Web Standards Solutions which mentions a topic on CSS attribute selectors. The short and informative article inspired me to look further into CSS atrribute selectors, where I came across this following article on how to add icons to links depending on the file type.
From this article I have managed to learn about CSS attribute selectors and I have decided to create my own test with fancier icons used from Fam Fam Fam.
Check my end result and view the source of the page to see how the results was achieved.
View example
I think this is nice code snippet and is interesting on how CSS can be used. If you have any questions or comments I would be happy to try and answer them.