W3C home > Mailing lists > Public > www-style@w3.org > March 2002

Re: CSS3 - Define Language

From: Tantek Çelik <tantek@cs.stanford.edu>
Date: Sun, 17 Mar 2002 15:38:25 -0600
To: Rijk van Geijtenbeek <rijk@iname.com>, www-style@w3.org
Message-id: <B8BA68F0.817%tantek@cs.stanford.edu>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:13 GMT