<?xml version="1.0" encoding="utf-8"?>

Id values must be unique

Id values must be unique Bad Practice
Id values must be unique Best Practice

Two different people can have the same name, but it's not the case for elements' ids. Within one document, no two elements should have the same id, and each element can have only one id — this is just the way it is!

Technically, CSS itself doesn't have a problem with repeated ids — it will just apply the same rule for them. JavaScript, however, requires all ids to be unique, and, in general, complying with language rules makes your code better and more adaptable to future changes.

Improve your UX & Product skills with interactive courses that actually work