📜  html lang - Html (1)

📅  最后修改于: 2023-12-03 15:15:34.215000             🧑  作者: Mango

HTML lang - HTML

HTML (Hypertext Markup Language) is the standard markup language used to create web pages. It is used to structure content on the web and provides a way to describe the meaning and purpose of content on a web page.

HTML lang Attribute

The lang attribute is used to specify the language of the web page. This is important for screen readers and other assistive technologies that need to know the language of the content in order to properly provide access to it. The lang attribute should be used on the <html> tag to specify the language of the entire document.

Syntax
<html lang="language-code">
  <!-- content here -->
</html>

The language-code value should be a two-letter language code according to ISO 639-1 standard. For example, en for English, fr for French, ja for Japanese, etc.

Example
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>My Web Page</title>
  </head>
  <body>
    <h1>Welcome to My Web Page</h1>
    <p>This is an example of a web page.</p>
  </body>
</html>

In this example, the lang attribute is used to specify that the language of the web page is English (en).

Conclusion

Using the lang attribute is important for accessibility and allowing assistive technologies to properly access the content on a web page. It is recommended to always include the lang attribute on the <html> tag of your web page with the appropriate language code.