CSS: Add Icon to Links
You can add a little icon to links to indicate what type of link it is.
For example, suppose you have links to Twitter like this:
<a href="https://x.com/xah_lee">Xah Lee</a>
And you want browser to show a icon, like this
Instead of using a img tag for each link, you should use CSS to add them, by matching the URL.
Code
a[href*="x.com/"] { background: url("i/x.com_favicon.ico") no-repeat left center; padding-left: 38px; }
CSS, Background Image
CSS, misc, advanced
- CSS: Case Sensitivity
- CSS: Declare Charset
- CSS: Comment Syntax
- CSS: Default Unit
- CSS: Computed Style
- CSS: Pseudo Element
- CSS: Pseudo Class
- CSS: Specificity
- CSS: Data URI Scheme
- HTML: Protocol-Relative URL
- CSS: Browser Default Style Sheet (2025-12)