Display the file type as an image on a linkTag(s): HTML/CSS


<style>
a[href$='.pdf'] {
display:inline-block;
padding-right:20px;
line-height:18px;
background:transparent url(../images/pdf.gif) center right no-repeat;
}
</style>

It looks like

realhowto-vbs.pdf

The $ operator means "ends with".

The ^ operator means starts with, so it's possible to detect "http:" or "mailto:" link and display special icon!

<style>
a[href^="mailto:"] {
display:inline-block;
padding-right:20px;
background:transparent url(../images/link.jpg) center right no-repeat;
}
</style>

It looks like

Write to Elvis!

See this interesting article more infos on the subject.


blog comments powered by Disqus