Picto thématique

Rule n° 229 - Each HTML ID is only used once per page.

A website is not designed for a particular browser. It will be displayed in various consultation tools whose behaviours, in case of error in the code, will be very varied. Avoiding code errors therefore means preventing display problems. So, of course, absolute compliance with W3C standards is not always necessary. On the other hand, the multiple presence of the same identifier in a page can have a blocking impact, at least in terms of accessibility.

#Accessibility #Development #Structure and code

Goal

  • Prevent content reproduction errors and interaction errors via scripts.
  • Limit the risk of random interpretation of the Document Object Model (DOM) by different user agents.
  • Improve the accessibility of content for people with disabilities.

Implementation

The most drastic solution is to ensure the complete validity of the source code of the pages, using a validator such as http://validator.w3.org. However, this solution leads to taking account of all the source code validation errors which do not fall within the scope of this best practice. To keep to the scope of this best practice, take care to avoid any duplicate value of an id attribute in the same HTML page.

Find out more:

Control

Submit the page to the W3C HTML validator (validator.w3.org) or other code validation tool and verify that each id attribute value is unique within the page.

By Opquast - Read the license


Discover Opquast training and certification

The objective of these rules and the Opquast community mission is ‘making the web better’ for your customers and for everyone! Opquast rules cover the key major areas of risk that can negatively affect website users such as privacy, ecodesign, accessibility and security.

Opquast training has already allowed over 19,000 web professionals to have their skills certified. Train your teams, contact us

We offer a 1 hour free discovery module.