Quick answer
The id attribute must be unique in the document.
HTML Duplicate ID
The id attribute must be unique in the document. Duplicate IDs break accessibility and JavaScript getElementById.
Common causes
- Same id on two elements.
- Copy-paste without changing id.
How to fix
- Give each element a unique id.
- Use class for shared styling; id for unique.
FAQ
- Can two elements have same id?
- No. id must be unique.
- What if I need same style?
- Use class.
Fix it now
Try in validator (prefill this example)