HTML — The basics

Guide 03 / 4

HTML workshop · À table !

Build a semantic recipe page that is readable without CSS and usable with a keyboard.

Expected outcome :

Reproduce a working result, test it, then succeed at an exercise without copying.

Reading
0%

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.

mini-blog/
└── index.html
Remember :

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.

h1 : À table !
h2 : Nos recettes maison
h3 : Soupe de carottes
h4 : Ingrédients / Préparation
Remember :

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.

<li>Une pincée de cumin</li>
Remember :

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.

mini-blog/
├── index.html
└── images/
    └── soupe.jpg
Remember :

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.

Cahier des charges :
- un h3 ;
- data-titre et data-duree ;
- deux h4 ;
- ingrédients dans ul ; étapes dans ol.
Remember :

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.

<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.

Attendu :
- aucun id dupliqué ;
- aucun lien interne sans cible ;
- des listes et titres dans le bon ordre ;
- accès au contenu avec le clavier.
Remember :

A validator helps spot markup errors; proofreading the texts and testing the keyboard are still necessary.