Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Font Size Based on Language

Tags:

html

css

unicode

So i have read a few suggestions with the css language tag, but it seems like everything requires placing the language in the tag in advanced. I am not able to change the html tags around the korean language, it has the same h1 tag as the english. It is because it is a translated version of the same website.

I want to have a different font and font size for the korean version than the english. Can i do this by just knowing the language? I found some other questions dealing with the unicode range that used @font-face { } , for one, I cant figure out what unicode range Korean is, i have tried looking at all the documentation but i just dont comprehend how unicode ranges are calculated and written. Also, i was hoping there was an option like,

h1{
unicode-range: korean;
font-size: 10px;
}

h1{
unicode-range: english;
font-size 20px;
}

Can this be done?

Thanks!

like image 461
user-2147482637 Avatar asked Mar 07 '13 09:03

user-2147482637


People also ask

How can I change my font style of language?

Open the "Go Settings" app on your phone. Click on the "Font" option and then the "Select Font" option.

How do I change the font in HTML language?

How to Change Font Type in HTML. To change font type purely with HTML, use the CSS font-family property. Set it to the value you want and place it inside a style attribute. Then add this style attribute to an HTML element, like a paragraph, heading, button, or span tag.

How do you change text size in CSS?

To change the size of your text with inline CSS, you have to do it with the style attribute. You type in the font-size property, and then assign it a value.

How do I manually change the font size?

Change the size of selected text Select the text or cells with text you want to change. To select all text in a Word document, press Ctrl + A. On the Home tab, click the font size in the Font Size box.


2 Answers

In your case the lang attribute is set on the html tag, so you could style all the elements you need based on that using the rules:

html:lang(en) h1{
    font-size: 20px;
}

html:lang(ko) h1{
    font-size: 10px;
}

Be careful, though, the the :lang pseudo-class is supported only in IE8+. Should you need support in IE7+, your best bet is going for the syntax of this type: a[lang="en"].

like image 110
Sunyatasattva Avatar answered Sep 19 '22 09:09

Sunyatasattva


You could use the CSS :lang pseudo class if you set the lang attribute in your HTML to alter the style. For example see demo or the following code:

CSS

:lang(en) {
    font-size:20px;
}

:lang(fr) {
    font-size:10px;
}

HTML

<p lang="en">Lorem</p>
<p lang="fr">Lorem</p>
like image 37
andyb Avatar answered Sep 22 '22 09:09

andyb