Dynamically generated HTML link icons .. with CSS-only!

Yes we could add icons to links by simply assigning classes or IDs. But could we dynamically add icons by analysing file names, links or the existence of certain attributes?

Yes we can! All with the CSS attribute selector.

CSS attribute selectors

--

--

Senior Web Developer, Creative Technologist with over 12 years experience | JavaScript, HTML, CSS, Artificial Intelligence

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mate Marschalko

Senior Web Developer, Creative Technologist with over 12 years experience | JavaScript, HTML, CSS, Artificial Intelligence