Attribute-Specific Icons


/ Published in: CSS
Save to your folder(s)

CSS Attribute selectors are very powerful giving you many options to control styles of different elements e.g. you can add an icon based on the href attribute of the a tag to let the user know whether link points to an image, pdf, doc file etc.


Copy this code and paste it in your HTML
  1. a[href$='.doc'] {
  2. padding:0 20px 0 0;
  3. background:transparent url(/graphics/icons/doc.gif) no-repeat center right;
  4. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.