Posted By

JimSangwine on 05/05/11


Tagged


Versions (?)

Style Links Depending on Destination


 / Published in: CSS
 

  1. a[href^="http://"] {
  2. /* fully valid URL, likely external link */
  3. }
  4.  
  5. a[href="http://google.com"] {
  6. /* link to specific website */
  7. }
  8.  
  9. a[href^="/"], a[href^=".."] {
  10. /* internal relative link */
  11. }
  12.  
  13. a[href^="mailto:"] {
  14. /* email link */
  15. }
  16.  
  17. a[href$=".pdf"] {
  18. /* PDF file */
  19. }
  20.  
  21. a[href$=".doc"] {
  22. /* Microsoft Word document */
  23. }
  24.  
  25. a[href$=".mp3"] {
  26. /* Music file */
  27. }
  28.  
  29. a[href$=".zip"] {
  30. /* Archive file */
  31. }

Report this snippet  

You need to login to post a comment.