![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| ||||
| ||||
|
|
I found some advice on how to style ‘user-friendly hyperlinks’: /* provide info about non-html links, following http://www.euronet.nl/~tekelenb/WWW/userfriendlierhyperlinks/ */ |
|
a[type="application/pdf"]:after { content: "(pdf)"; font-size: 80%; vertical-align: super } [...] a[hreflang="nl"]:after { content: "(nl)"; font-size: 80%; vertical-align: super } [...] As a sidenote: is there an easier way, where I can tell the content attribute to take the value of the hreflang, so that I can collapse these three into one? |
|
Now the problem is: these conflict, if I have a link like the following: a href="CVs/cv-nl.pdf" title="My curriculum vitae in Dutch" type="application/pdf" hreflang="nl">Dutch</a |
|
it is rendered as Dutch<sup>(nl)</sup>, |
#3
| |||
| |||
|
|
a[hreflang="en"]:after { content: "(en)"; } a[hreflang="nl"]:after { content: "(nl)"; } As a sidenote: is there an easier way, where I can tell the content attribute to take the value of the hreflang, so that I can collapse these three into one? |
|
a href="CVs/cv-nl.pdf" title="My curriculum vitae in Dutch" type="application/pdf" hreflang="nl">Dutch</a it is rendered as Dutch<sup>(nl)</sup>, as you can see at http://tcl.sfs.uni-tuebingen.de/~hendrik/#CV. So the (pdf) is lost. Is there a way to reconcile these two and have both? |
#4
| ||||
| ||||
|
|
Hendrik Maryns wrote: I found some advice on how to style ‘user-friendly hyperlinks’: /* provide info about non-html links, following http://www.euronet.nl/~tekelenb/WWW/userfriendlierhyperlinks/ */ It's nice in theory but it still fails in most browsing situations. However, it fails gracefully (no harm done, the effect is just missing). |
|
a[type="application/pdf"]:after { content: "(pdf)"; font-size: 80%; vertical-align: super } [...] a[hreflang="nl"]:after { content: "(nl)"; font-size: 80%; vertical-align: super } [...] As a sidenote: is there an easier way, where I can tell the content attribute to take the value of the hreflang, so that I can collapse these three into one? You can use a[hreflang]:after { content: "(" attr(hreflang) ")"; font-size: 80%; vertical-align: super } |
|
Now the problem is: these conflict, if I have a link like the following: a href="CVs/cv-nl.pdf" title="My curriculum vitae in Dutch" type="application/pdf" hreflang="nl">Dutch</a Technically, they don't conflict, they just dance in the cascade. :-) Both the type-related and the hreflang-related rules apply to the element. The effect on a property is never cumulative. Instead, at most one rule affects a property. it is rendered as Dutch<sup>(nl)</sup>, In this case yes. Other things being equal - and they are equal here, the rules have selectors with the same specificity etc. - the latter rule wins. If you moved the type-related rule at the end of the style sheet, then the text indicating the type would appear. |
|
This is an inherent limitation in CSS. You could circumvent it in a clumsy manner: using several rules of the form a[type="application/pdf"][hreflang]:after { content: "(pdf)" "(" attr(hreflang) ")"; font-size: 80%; vertical-align: super; } |
#5
| |||
| |||
|
|
Op 10-12-08 20:01 heeft Jukka K. Korpela als volgt van zich laten horen: You can use a[hreflang]:after { content: "(" attr(hreflang) ")"; font-size: 80%; vertical-align: super } Ah, I knew there had to be something like this, great, thanks! |
![]() |
| Thread Tools | |
| Display Modes | |
| |