Different languages - one page


what for coding I have to include in the <head> of my page when I do want different languages on my page?

  • english
  • russian

hope you can help me out.


If the content is mainly in one language (e.g., English) then use <html lang="en"> and mark up the Russian bits with lang="ru".

If it’s a 50/50 split between the languages, omit the lang attribute for the <html> tag and set it on each bit of content instead.

You’ll probably want to use UTF-8 as the character encoding, so that you can easily mix Latin and Cyrillic letters on the same page. There are legacy encodings that allows this, too, but UTF-8 is usually the best choice.

How to set the lang=“ru” on the bit of text used on the page?


<p> here some text in ru, and next some eng again</p>


edit: forgot a thank you for the first reply :slight_smile:

<p lang="ru">Cyrillic letters</p>
<p lang="en">Latin  letters</p>

That’d be quite some work there for websites with tons of multi-lingual content on a per document basis.

thanks for showing.

by that I also can put it in some <div style="lang=“ru”; "> ?

lang is an attribute so the correct syntax for it is:

<div lang="en"></div>

No, but you can use <div lang="ru">...</div>. (The language isn’t a styling option.)
The lang attribute is valid for most HTML element types.