Testing conformance to W3C standards
The W3C HTML and CSS validators and how to read their messages, automatic accessibility audit tools (axe, WAVE, Lighthouse) and what they cannot see.
- 22 cards
- 3 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
A few cards from the deck
W3C HTML validator: what is it?
Show the answer
An online tool which reads a document and flags each place where the markup departs from the rules of the HTML specification.
Its engine is called the Nu Html Checker. It checks the grammar of the markup: badly closed tags, misplaced elements, missing attributes. It says nothing about how the page is actually used.
The validator answers: "Element “li” not allowed as child of element “div” in this context." Which fix?
```html
<div>
<li>Accueil</li>
<li>Contact</li>
</div>`- Replace the
divwith aul - Replace the
divwith anav - Add
role="list"to thediv - Add a unique
idto eachli
Show the answer
Replace the
divwith aulAn
lionly makes sense inside a list:ul,olormenu. The message says exactly that: the parentdivis not allowed. Anavis not a list (aulgoes inside it), an ARIA role does not make the markup valid and anidis unrelated.- Replace the
The W3C's Nu Html Checker validates the … of the HTML markup, but not the actual … of the page.
Show the answer
The W3C's Nu Html Checker validates the grammar of the HTML markup, but not the actual accessibility of the page.
A page can be valid and unusable by keyboard, or accessible with a few markup errors: the two checks are complementary.
W3C CSS validator: what is it?
Show the answer
A tool that reads a style sheet and reports unknown properties, invalid values and syntax errors.
The browser silently drops an invalid declaration: the validator is one of the few ways to learn that a rule was thrown away.
The validator reports "No “p” element in scope but a “p” end tag seen." on the last line. What is the cause?
```html
<p>Bonjour
<div>monde</div>
</p>`- A
</div>is missing right before the final</p>on the last line - The
divalready closed thep,</p>is surplus - The
pis opened twice, once before and once after thediv - The text "Bonjour" must sit in a tag, not bare inside the
p
Show the answer
The
divalready closed thep,</p>is surplusA
pmay only hold phrasing content: when thedivopens, the browser closes thepby itself. The final</p>then closes nothing, since nopis open. Rewrite with adivaround both, or aspanin place of thediv.- A