
The HTML lang attribute defines the language of the element’s content.
Syntax:
<element lang="language_code">
language_code – defines the language code for the element’s content (example: “en” – English, “it” – Italian, “ja” – Japanese…).
Example:
<!DOCTYPE html>
<html>
<body>
<p>How are you?</p>
<p lang="es">¿Cómo estás?</p>
</body>
</html>
Output:
How are you?
¿Cómo estás?
It is a good practice to include the HTML lang attribute inside the <html> tag, to declare the language of your website (this is meant to assist search engines and browsers):
<html lang="en">
...
</html>
Enjoy coding!
Read also: