2010-04-26

icone generate automaticamente

Segnalo un interessante tip (da Opera-dev):

You can use attribute selectors with the content property to render icons after a link based on what file format it is or if it is an external one.

a[href $='.pdf']:after {   content:url(icon-pdf.png);}  

a[rel="external"]:after {  /* You can also use a[href ^="http"]:after */
   content:url(icon-external.png);}

the first rule uses a CSS3 selector with substring matching — href $='.pdf' means "href attributes with .pdf at the end of the value."

As with regular expressions, ^ and $ refer to the start and end of a string, respectively. With CSS 3 substring matching attribute selectors, [attribute^=value] and [attribute$=value] allow you to match elements whose attribute content starts or ends with the specified value, while [attribute*=value] selects elements where the value is found anywhere in the attribute.

No comments:

Post a Comment

Blog Archive