Forum Moderators: open

Message Too Old, No Replies

Mixed Languages and Fonts

Choosing to use different fonts for different languages

         

brodyh

9:05 am on May 23, 2009 (gmt 0)

10+ Year Member



I have a website is mostly English but contains Japanese characters (don't worry, I have all the encoding stuff figured out..). What I would like to do is be able to mix the two but select different fonts for each language in CSS without creating new classes, spans, divs, etc.

..Is this possible with CSS?

tedster

9:28 pm on May 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CSS rules need some kind of selector in order to work at all. You might only need one class in the CSS but you would need to apply it to various places in your mark-up - spans, divs, elements life <p> and so on.

You also might make good use of child selectors in your css files to make the code more efficient.

What kind of approach were you hoping for?

swa66

11:05 pm on May 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if you use the lang=".." html atributes, you could use the CSS2.1 selectors that trigger on them:
either E:lang(xx) or E[lang="xx"] would work according to the standard. I'm not sure if ":lang(xx)" is implemented at all (never tried it), but I know E[lang="xx"] is not supported by IE6.

Still it's usable if you accept a scripted solution for IE6 like IE7.js.

But as tedster said: you need something, a span, a class, a lang attribute, ...

brodyh

12:13 am on May 24, 2009 (gmt 0)

10+ Year Member



Well I am willing to use <span>'s if they have the xml:lang attributes.. I just thought maybe there was a simpler way to do this. I will look into the CSS 2.1 selectors.
As horrible as this sounds, I don't support writing workarounds for IE. It's like the philosophy of many who don't eat meat.. the ones who know that they won't make a huge difference but it's a personal choice. It's the same way with me and IE.