Guide 03 / 4
HTML workshop · À table !
Build a semantic recipe page that is readable without CSS and usable with a keyboard.
Reproduce a working result, test it, then succeed at an exercise without copying.
01 · Building the first version
Goal: three recipes that are fully readable, even without styling.
Step 1 · Create and open index.html
Create mini-blog/index.html and reproduce in it the complete file provided at the end of this workshop. Open it in the browser and keep the editor beside it.
Example
mini-blog/
└── index.html
Expected result: the title À table ! and three recipes are displayed. The filter controls stay invisible; that is intended at this step.
Step 2 · Read the structure
Spot head and body, then the page zones. Explain why each recipe is an article. In the browser tools, inspect the soup's title.
Example
h1 : À table !
h2 : Nos recettes maison
h3 : Soupe de carottes
h4 : Ingrédients / Préparation
Expected result: you can explain each level without mentioning size or colour.
Step 3 · Modify without breaking
Change the tagline, then add an ingredient to the soup. Save and reload. Then change a #recettes destination to #inconnu, notice the error, then restore #recettes.
Example
<li>Une pincée de cumin</li>
Expected result: only the added ingredient appears; the Les recettes link leads to the section after the fix.
Step 4 · Add a photo, if desired
Create images/, drop in a personal photo named soupe.jpg, then add the figure fragment from the essentials guide to the soup article. Adapt the alternative text to the photo.
Example
mini-blog/
├── index.html
└── images/
└── soupe.jpg
Expected result: the photo is displayed. By temporarily changing its path, check that its alternative text conveys information.
02 · Practise and check
Try on your own, then compare with the solution.
Exercise · Add a fourth recipe
Add an article “Compote de pommes”, 15 minutes, 2 servings. Use a unique id, the recette class, the data attributes, an ingredient list and a step list. Set the static counter to 4.
Example
Cahier des charges :
- un h3 ;
- data-titre et data-duree ;
- deux h4 ;
- ingrédients dans ul ; étapes dans ol.
Try before reading the next sheet. The JavaScript course script will then recalculate the counter.
Solution · A consistent fourth card
Insert this article in div.recettes, after the tart. Keep the same class and attribute names for the following courses.
Example
<article id="compote" class="recette" data-titre="Compote de pommes" data-duree="15">
<h3>Compote de pommes</h3>
<p class="meta">15 min · 2 personnes · Dessert</p>
<h4>Ingrédients</h4>
<ul><li>2 pommes</li><li>Un peu d’eau</li></ul>
<h4>Préparation</h4>
<ol><li>Couper les pommes.</li><li>Cuire puis écraser.</li></ol>
</article>
Check · Validate the document
Copy the document into the W3C HTML validator via the resources link. Fix one error at a time. Then go through all the links with Tab then Enter.
Example
Attendu :
- aucun id dupliqué ;
- aucun lien interne sans cible ;
- des listes et titres dans le bon ordre ;
- accès au contenu avec le clavier.
A validator helps spot markup errors; proofreading the texts and testing the keyboard are still necessary.