CSS: Style links depending on file format

CSS: Style links depending on file format

A short CSS snippet that changes the styling of external links, email links and links to pdf documents.

/* external links */
a[href^="http://"]{
    padding-right: 20px;
    background: url(external.gif) no-repeat center right;
}

/* emails */

a[href^="mailto:"]{
padding-right: 20px;

background: url(email.png) no-repeat center right;

}

/* pdfs */

a[href$=".pdf"]{
padding-right: 20px;
background: url(pdf.png) no-repeat center right;

Pin It on Pinterest

Share This