HTML lang Attribute

HTML lang Attribute: This attribute defines the language of the content of the element. Some of the examples for languages are en for English, es for Spanish, etc. The lang attribute will guide the search engine and browsers to understand the basic language for the website. Based on the ISO standard each language will have a unique code to declare in the lang attribute.

HTML lang Attribute

This attribute can be applied to all the HTML elements.

Attribute Value: This attribute contains single value language_code which is used to specify the language of the content.

Syntax: <element lang = “language_code”>

Browser Support

This attribute is supported by the following browsers:

  • Chrome
  • Firefox
  • Internet Explorer
  • Safari
  • Opera

Example: for lang Attribute 

<!DOCTYPE html> 
    <title>lang attribute</title> 
      body { 
      h1 { 
    <h2>lang attribute</h2> 
    <p lang = "en">A tutorial and job portal for Freshers</p> 


HTML lang attribute