====== 4.1.1. Write valid HTML code according to the grammar rules of the DOCTYPE used ======
On each page, a DOCTYPE must be used, and the HTML code must be valid according to the rules of the selected DOCTYPE. The choice of DOCTYPE is open.
It is especially important to:
* Correctly nest the tags.
* Provide the corresponding closing tag for each opening tag.
* Avoid duplicate attributes for the same tag.
* Ensure the uniqueness of each id attribute within a page.
**Note**
Only validation errors are to be corrected. The warnings returned by the validator do not need to be taken into account with respect to this criteria, because they have no impact on accessibility.
**Tip**
* The list of official DOCTYPE’s is available at this address: http://www.w3.org/QA/2002/04/valid-dtd-list.html.
* Use the W3C validator, available at the following address, to test the validity of your HTML code: http://validator.w3.org/.
**Warning**
Including ARIA attributes in the HTML code is a real advantage for accessibility but will invalidate the source code if the page is not produced in HTML5. If errors are returned following the inclusion of these attributes, they do not need correcting.
===== Related recommendations =====
* Previous recommendation: [[notices:html-css:utiliser-l-attribut-lang-pour-signaler-les-changements-de-langue-dans-le-corps-de-la-page]]
* Next recommendation: [[notices:html-css:ne-pas-utiliser-d-attributs-ou-de-balises-html-destines-exclusivement-a-la-mise-en-forme]]