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;  
}

About the author

Hamid Awan

Hamid Awan is a computer Geek, Internet Entrepreneur, Business Guy, Day Dreamer, Fitness Freak, Music Lover, Blogger and Digital Marketing Specialist. He also helps companies to grow their Online Business. At Tech Entires he writes about Money Making Ideas, Business, Android Apps, Blogging, WordPress, SEO, Technology and Computer Tips and Tricks. If you have any suggestion, you can contact us through our Contact Us Page

Leave a Comment