The way i would consider doing this (without using a script) is to give the link a class of *class="pdf"* and style it from there.

So an example would be like:

*<HTML>
<a class="pdf" href="files/example.pdf" title="pdf document">Link name.pdf</a>

<CSS>
a.pdf {
  display: block;
  padding-left: 16px;
  background: url('<imageDirectory>/icon_pdf.png') top left no-repeat;
}*

So this example takes your *<a>* tag with *class="pdf"* and converts it to a *block* element from an *inline *element. We add some padding to the left side, and sets the background to your pdf icon. The padding moves the text over so the background shows.

Hope this helps,

-- Brandtley McMinn
Gigglebox Studios - Creative Director
[email protected]
512.406.1666


On 9/7/2010 10:35 AM, Kunal Bajpai wrote:
I am new CSS and would like to know whether there is a way so that one
could set an icon next to a document (PDF, Word Doc, etc) based on the
extension of the document to which HREF is pointing.

TIA
Kunal


--
--
You received this because you are subscribed to the "Design the Web with CSS" 
at Google groups.
To post: [email protected]
To unsubscribe: [email protected]

Reply via email to