logo Learn HTML
  • Home
  • Tutorials
  • Practice
  • Quiz
  • Projects
  • About
  • Contact

HTML Course

  • HTML HOME
  • HTML Introduction
  • HTML Basic
  • HTML Element
  • HTML Attributes
  • HTML Headings
  • HTML Paragrapha
  • HTML Style
  • HTML Formattin
  • HTML Quotations
  • HTML Colors
  • HTML Css
  • HTML Links
  • HTML Image
  • HTML Favicon
  • Page Tittle
  • HTML Tables
  • HTML Lists
  • Block & Inline
  • HTML Div
  • HTML Classes
  • HTML Id
  • HTML Buttons
  • HTML Iframes
  • HTML File Paths
  • HTML Head
  • HTML Layout
  • HTML Symbols
  • HTML Emojis
  • HTML URL Encode
  • HTML VS XHTML
  • HTML FROM
  • HTML Form
  • Form Attributes
  • Form Elements
  • HTML Input Types
  • HTML Input Attributes
  • Input Form Attributes
  • HTML Graphics
  • HTML Canvas
  • HTML SVG
  • HTML Media
  • HTML Media
  • HTML Video
  • HTML Audio
  • HTML Plug-ins
  • HTML Youtube
  • HTML APIS
  • HTML Web APIS
  • HTML Geolocation
  • HTML Drag & Drop
  • Web Storage
  • Web Workers
  • HTML SSE
  • HTML Examples
  • HTML Examples
  • HTML Editor
  • HTML Quiz
  • HTML Exercises
  • HTML References
  • HTML Tag List
  • HTML Attributes
  • HTML Global Attributes
  • HTML Brower Support
  • HTML Events
  • HTML Colors
  • HTML Canvas
  • HTML Audio & Video
  • HTML Doctypes
  • HTML Character Sets
  • HTML URL Encode
  • Language Codes
  • HTTP Messages
  • HTTP Methods
  • PX to EM Converter
  • keyboard Shortcuts

HTML ISO Language Codes

Always include the lang attribute inside the <html> tag to declare the primary language of your webpage. This attribute helps search engines (like Google) categorize your site and helps screen readers pronounce content correctly for visually impaired users.


1. Modern HTML5 Declaration

In HTML5, the declaration is very simple and goes at the very top of your document.

Example

<!DOCTYPE html>
<html lang="en">
<head>

<title> LearnHTML Tutorial </title>
</head>
<body>
...
</body>
</html>

2. XHTML Declaration

If you are working with older XHTML documents, the language must be declared twice (for both XML and HTML compatibility).

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

3. Common ISO Language Codes

ISO 639-1 provides standard two-letter codes for most languages. Here are the most common ones you might use on LearnHTML:


Language Code Language Code
English en Urdu ur
Spanish es Hindi hi
French fr Arabic ar
Chinese zh German de
Russian ru Japanese ja

4. Language Dialects (Regional Codes)

Sometimes, you need to be more specific. You can add a country code to the language code to specify a regional dialect (e.g., Language-Country).

  • en-US: English (United States)
  • en-GB: English (United Kingdom)
  • fr-CA: French (Canada)
  • es-MX: Spanish (Mexico)

LearnHTML Quick Tips

  • Consistency: Use one primary language per page.
  • ccessibility: Screen readers use the lang attribute to switch voices/accents.
  • SEO: Correct language tags prevent your site from being shown to users who cannot read your language.

Try It Your Self

Sign Up For New
Update

HTML Basic
  1. HTML Basic
  2. HTML Element
  3. HTML Attributes
  4. HTML Headings
  5. HTML Paragrapha
  6. HTML Tables
  7. HTML Lists
HTML Advance
  1. HTML Div
  2. HTML Classes
  3. HTML Id
  4. HTML Buttons
  5. HTML Iframes
  6. HTML Symbols
  7. HTML Emojis