Search code examples
htmllang

Why can't I make lang an element?


I recently came across this tidbit of code below while debugging a website of mine.

<lang="[insert language code here]">

Why should we never ever do this?


Solution

  • Because lang is an attribute, not a tag and it is defined inside HTML tag

    <html lang="en">