The :lang() selector and font-size in %

Dear Richard, all

Presentation styles are commonly used to control changes in fonts, font 
sizes etc. when language changes occur in the document.
In "Styling using language attributes" 
(http://www.w3.org/International/questions/qa-css-lang.en.php) the first 
example:

em           { font-style: italic; }
em:lang(ja)  { font-style: normal; font-emphasize: dot before; }

<p>This is <em>English</em>, but <span lang="ja">これは<em>日本語</em>で 
す。</span></p>

shows the advantage of :lang() vs *[lang=".."].

But the :lang() selector has also a disadvantage against *[lang=".."]. 
In the following (similar) example:

:lang(fr) { font-style: italic; font-size:130%; }

<p>This is <em>English</em>, but <span lang="fr">ceci est 
<em>Français</em>, non?</span></p>

the word Français will be italicized, OK, but amplified 130% twice! (And 
as much as there are nested elements. Imagine <em><a 
...>Français</a></em>). Here, *[lang="fr"] selector would be more 
appropriate.

I think the article above should also mention this point, because 
styling to accommodate language change is mainly about font-size.


I often use the lang attribute in styling to better harmonize the look 
(font-size) when some Arabic and Latin fonts are mixed. My preferred 
Arabic fonts ("Al Bayan" or "Traditional Arabic") look smaller.

Regards,

Najib

--
Najib TOUNSI (tounsi at w3.org)
W3C Office in Morocco (http://www.w3c.org.ma/)
Ecole Mohammadia d'Ingénieurs, BP. 765 Agdal-RABAT Morocco
Tel: +212 (0) 537 77.05.98 Mobile: +212 (0) 661 22 00 30

Received on Wednesday, 19 September 2012 13:29:01 UTC