Skip to content Skip to sidebar Skip to footer

Html Validation Error For Html Lang Attribute

I am getting this error message: This document appears to be Lorem ipsum text but the html start tag has lang='en'. Consider using lang='zxx' (or variant) instead. From line 5, co

Solution 1:

You're using lorem ipsum, which isn't English. Changing the language attribute to zxx should fix the validation warning. zxx is used when the language is unknown.

Your options:

  1. Change en to zxx --- html lang="zxx"
  2. Replace lorem ipsum with English dummy text and keep en
  3. Ignore the warning until you update your page with real content

https://github.com/validator/validator/issues/321


Solution 2:

Use lang="zxx" to tagging text with no language.

You can use lang attributes in your block and inline elements like <p>, <span>, <a> etc., as long as your page is in English, for example:

<p lang="zxx">Lorem ipsum</p>

Webpage in English language:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Test</title>
    <meta charset="utf-8">
</head>
<body>
    ...
    <!-- Elements in English: without lang attribute -->
    <p>Hello World</p>
    ...
    <!-- Elements in other languages: with lang attribute -->
    <p lang="de">Hallo Welt</p>
    ...
    <!-- Elements with Unknown language: with lang (zxx) attribute -->
    <p lang="zxx">Lorem ipsum</p>
    ...
    <!-- Mixed -->
    <p>This Page contains <span lang="zxx">Lorem ipsum</span> Text!</p>
    <p>German Words like: <span lang="de">Hallo, Welt</span></p>
    <p lang="zxx">Lorem ipsum <span lang="en">Hello World</span></p>
    <p>The language is in <span title="Spanish" lang="es">EspaƱol</span></p>
    ...
</body>
</html>

Or HTML language declaration for unknown language:

<!DOCTYPE html>
<html lang="zxx">
<head>
    <title>Lorem ipsum</title>
    <meta charset="utf-8">
</head>
<body>
    ...
    <!-- don't need lang attribute -->
    <p>Lorem ipsum dolor sit amet</p>
    ...
    <!-- The language is known -->
    <p lang="en" title="English">Hello World</p>
    <p lang="de" title="German">Hallo Welt</p>
    ...
</body>
</html>

Post a Comment for "Html Validation Error For Html Lang Attribute"