Sunday, August 18, 2013

How to Make Style Links Depending on Destination

Here full CSS code of how to make style links depending on a specific destinations.

a[href^="http://"] {
/* fully valid URL, likely external link */
}

a[href="http://google.com"] {
/* link to specific website */
}

a[href^="/"], a[href^=".."] {
/* internal relative link */
}

a[href^="mailto:"] {
/* email link */
}

a[href$=".pdf"] {
/* PDF file */
}

a[href$=".doc"] {
/* Microsoft Word document */
}

a[href$=".mp3"] {
/* Music file */
}

a[href$=".zip"] {
/* Archive file */
}

Disqus Comments