According to the HTML5 standard, the value of the id attribute of an element must be unique amongst all the IDs in the element's home subtree. In particular, a single HTML document must not contain two elements with the same ID. Documents that do not conform to this restriction may be interpreted differently by different browsers.

Choose unique IDs for all elements inside a document. If the id attributes are used to attach style information to the elements via CSS, consider using class attributes instead.

The following HTML document contains two li elements with the same ID:

Instead, each element should have its own unique ID:

  • HTML5 Standard: 3.2.5.1 The id attribute.