Search code examples
htmllang

How to properly use lang in HTML


I want to ask you how to properly use lang in HTML code. Im trying to have website in 2 langs en, pl.

<html lang="en">
<html lang="pl">

Is this way correct?


Solution

  • You can't have two <html> tags in the same document. You should use one <html> tag without the lang attribute and use the lang attribute on tags that contain only one language. Here is an example:

    <html>
    <head>
        <!--some elements in the head-->
    </head>
    <body>
        <p lang="en">This is text</p>
        <p lang="fr">Ceci est du texte</p>
    </body>
    </html>