Skip to content

HTML rules

Duplicate ID

html

IDs should be unique.

Before

<div id="foo">Foo</div>
<div id="foo">Bar</div>

After

<div id="foo">Foo</div>
<div id="bar">Bar</div>

Missing component

html html html html html html html html html html html

Many tags require specific attributes.

Before

<!DOCTYPE html>
<html>
  <head>
    <title>Foo</title>
  </head>
  <body>
    <button>Click me</button>
    <input type="text"/>
    <img src=""/>
  </body>
</html>

After

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="description" content="Foo">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Foo</title>
  </head>
  <body>
    <button type="button">Click me</button>
    <input type="text" aria-label="Input"/>
    <img src="foo.png" alt="Foo image"/>
  </body>
</html>

Declaring

Lowercase syntax

html html

Tags and attributes should be lowercase.

Before

<DIV CLASS="foo">Foo</DIV>

After

<div class="foo">Foo</div>