Forum Moderators: not2easy
Given:
<a href="" xml:lang="nl" lang="nl">#*$!</a> why does:
a[lang]:after { content: " [" attr(lang) "]" } correctly show '#*$! [nl]', but:
a[xml¦lang]:after { content: " [" attr(xml¦lang) "]" } only show 'xxx' (with gecko 1.7)?
xml:lang is verging on non-existent - not surprising as when parsed as HTML (as virtually every page will be) the xml: syntax is pretty meaningless anyway. However, I don't think you've got the right approach: the
lang (or xml:lang) attribute defines the language of the contents between the <a> and </a> - but surely it would be more logical for the link to be marked with the language of the target document? For that, you can use the hreflang attribute. Here's a test page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>test template</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
[b]a[hreflang]:after { content: " [" attr(hreflang) "]" }[/b]
</style>
</head>
<body>
<p><a href="#" [b]hreflang="nl"[/b] lang="nl">test</a></p>
</body>
</html>
Wrt @lang, I was using it not only to signify the language of the page linked to, but also to signify the language of the link text. I've not seen @hreflang before, but in this case I assume I'd want to use both.
Thanks!