PHP Tricks

Style of chain links based on the File Type

Style of chain links based on the File Type: With the help of this code you can determinate the file type of your links using CSS selectors and insert icons as background images. These may include various protocols (HTTP, FTP, IRC, mailto) or just the same types of files (MP3, AVI, pdf).

The file to edit: Stile.cssStyle of chain links based on the File Type

Read Also: Execute PHP Code in Text Widgets

 


5
6
7
8
9
10
11
12
13
14
15
16
17
/* external links */  
a[href^=”http://”] {  
    padding-right: 13px;  
    background: url(‘external.gif’) no-repeat center rightright;  
}  
/* emails */  
a[href^=”mailto:”] {  
    padding-right: 20px;  
    background: url(’email.png’) no-repeat center rightright;  
}  
/* pdfs */  
a[href$=”.pdf”] {  
    padding-right: 18px;  
    background: url(‘acrobat.png’) no-repeat center rightright;  
}

Leave a Reply