How to quickly handle file extensions icons, only via CSS no JS no PHP

This is the quickest way to put different icons for downloadable files, via CSS, no JS or PHP needed.{
    content: url('default.gif');
    margin-right: 6px;
    vertical-align: middle;
    content: url('pdf.gif');
  }[href$='.doc']:before,[href$='.rtf']:before,[href$='.txt']:before  {
    content: url('doc.gif');
  }[href$='.docx']:before {
    content: url('docx.gif');
  }[href$='.xls']:before {
    content: url('xls.gif');
  }[href$='.xlsx']:before  {
    content: url('xlsx.gif');

Leave a Reply