Re: CSS3 - Define Language

On 3/17/02 5:53 AM, "Rijk van Geijtenbeek" <rijk@iname.com> wrote:

> Hello Tantek,
> 
> On Sunday, March 17, 2002 you wrote:
> 
> [..]
> 
>> The _correct_ way to select elements based on language is with the CSS2
>> :lang() selector, e.g.
> 
>> div:lang(en) {
>>       color: black;
>>       background-color: white;
>> }
> 
>> div:lang(es) {
>>       color: white;
>>       backgorund-color: black;
>> }
> 
>> Now, as far as implementations, IE5/Mac implements :lang() whereas I don't
>> know if any of the other browsers do.  You'll need to try them out and bug
>> their vendors accordingly.
> 
> Opera doesn't support :lang, but it does support attribute selectors,
> so you'd need this styling:
> 
> [lang|=en] > * { ...  }
> [lang|=no] > * { ...  }

Even that doesn't work.  E.g.

...
<body>
<p lang="en">
  Here is some english text.

  <a href="http://w3.org"><abbr>W3C</abbr></a>

</p>
...

Neither the <p> nor the <abbr> will be styled by those rules despite both of
them having language "en".

Sure, you could try to come up with more attribute selectors to try to cover
those cases as well, but the bottom line is that no amount of attribute
selectors will properly handle selecting on language - an author can specify
the content-language in the HTTP header, or using a META tag:

...
<head><title>e.g.</title>
 <meta http-equiv="Content-Language" content="en" />
...
</head>
<body>
...
</body>


There is no attribute selector that will allow you to style the contents of
the body element dependent on an attribute on an element in the head
element.

So, we're back to bug your vendors to support the CSS2 :lang() selector if
you wish to style based on language.

Thanks,

Tantek

Received on Sunday, 17 March 2002 16:35:50 UTC