Skip to content

Instantly share code, notes, and snippets.

@ruizfrontend
Created September 14, 2012 12:08
Show Gist options
  • Save ruizfrontend/3721570 to your computer and use it in GitHub Desktop.
Save ruizfrontend/3721570 to your computer and use it in GitHub Desktop.
css url specific links
/* enlaces externos
^= indica que queremos dar estilo a aquellos enlaces que comiencen por http://
*/
a[href^="http://"]{
padding-right: 20px;
background: url(external.gif) no-repeat center right;
}
/* emails
^= indica que queremos dar estilo a aquellos enlaces que comiencen con mailto:
*/
a[href^="mailto:"]{
padding-right: 20px;
background: url(email.png) no-repeat center right;
}
/* pdfs
$= indica que queremos dar estilo a aquellos links cuyos hrfs terminen con ".pdf".
*/
a[href$=".pdf"]{
padding-right: 20px;
background: url(pdf.png) no-repeat center right;
}
/* zip
Igual que el anterior pero para los archivos zip y se añade un icono a la derecha del enlace. Por ello lo de :after
*/
a[href$=".zip"]:after{
content: url(icons/zip.png);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment