pdf

Permalink
whats the best way to make a pdf download have a icon so there isn't a link but a icon to click?

bryanlewis
 
Remo replied on at Permalink Reply
Remo
you can do that quite easy with css, no need for anything fancy like a block or something like that..
wltr replied on at Permalink Reply
wltr
To be more precise

a[href$=".pdf"] {
background: url(path/to/pdf.gif) no-repeat scroll 0 50%;padding-left: 18px;
}

Does not work in IE6, but who cares.
Remo replied on at Permalink Reply
Remo
thanks, let's finish that css tutorial with a little ie6 addon ;-)

$('a[href$=".pdf"]').css({
    paddingLeft: '18px',
    background: 'url(path/to/pdf.gif) no-repeat scroll 0 50%'
  });
wltr replied on at Permalink Reply
wltr
Great tip.

jquery rocks! Swiss army knife for developers. No pun intended ;-)
bryanlewis replied on at Permalink Reply
bryanlewis
thanks a ton guys! I will try this out!
bryanlewis replied on at Permalink Reply 1 Attachment
bryanlewis
It worked but when I add a file in my tiny mce editor is displays the file name and a part of the icon.

Example is in the attachment...

Is there anyway to get rid of the file name?

This is my current CSS:

a[href$=".pdf"] {
background: url(images/PDF-Icon.jpg) no-repeat scroll 0 50%;padding-left: 18px;
width: 150px;
height: 150px;
}

Any help would be very appreciated!
wltr replied on at Permalink Reply
wltr
You can set a fixed width equal to the image width and hide the rest.

display: block; width: 18px; overflow: hidden;

But I'm not sure how this is interpreted by tinymce. I guess you have to experiment a bit.
bryanlewis replied on at Permalink Reply
bryanlewis
But, the file name is still there is there any way to get rid of this?
wltr replied on at Permalink Reply
wltr
you could try:

text-indent: -999px;

But from that point on you are entering advanced css techniques :-S

OR alternatively use a HTML img-tag.
bryanlewis replied on at Permalink Reply
bryanlewis
It makes the boss happy so if he is happy I am happy! Thanks a ton! You helped out a great deal!