Language/country codes in HTML

Language codes in HTML

To define a language code in HTML, we should always include the lang attribute inside the <html> tag to define the language.

The given code defines the language in HTML. The code is followed by the ISO 639-1 language codes. We will go to the browser, select the code of any language, and put the code in it:

<html lang="en">
.....
</html>

Country codes in HTML

In HTML, country codes can be used as an addition to the language code in the lang attribute.

The given code is used to define both the language and the country. The code is followed by the ISO 639-1 country codes. We will go to the browser, select the code of any country, and put it in:

<html lang="en-US">
...
</html>

In the lang attribute, the first two characters of the language code before - define the language code. The last two characters of the code after - define the country code.

Free Resources