Web development

HTML lang Attribute

Learn how to use the HTML lang Attribute.

HTML lang Attribute

The HTML lang attribute defines the language of the element’s content.


<element lang="language_code"> 

language_code – defines the language code for the element’s content (example: “en” – English, “it” – Italian, “ja” – Japanese…).


<!DOCTYPE html>

<p>How are you?</p>
<p lang="es">¿Cómo estás?</p>



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">

Enjoy coding!

Read also:

HTML action Attribute

HTML href Attribute

HTML id Attribute