CSS — The basics

Guide 04 / 4

Resources and review

Learn to consult documentation, solve an error and check what you have learned.

Expected outcome :

Find reliable information and explain what you have built.

Reading
0%

01 · Reading the documentation while practising

Use the resources linked under the guide to check one property at a time.

MDN · Styling basics

Read a simple rule, then find its three parts in style.css: selector, property and value.

Mission : expliquer .recette { padding: 1.25rem; } sans employer « ça fait joli ».

MDN · box-sizing and Grid

Compare content-box and border-box with the same width and the same padding, then explore a two-column grid.

Mission : dessiner les couches d’une carte puis prédire sa largeur.

W3C · CSS Validator

Paste style.css into the validator and examine the messages. Valid syntax does not guarantee a good layout: also compare with the expected results.

Mission : retirer une accolade, lire le message puis la remettre.

02 · Troubleshooting and preparing for JavaScript

Isolate the file or the rule at fault before changing several things.

No style is applied

Check href, the name style.css and its location. In Network, the file must respond correctly; in Elements, the rules must appear.

Si index.html et style.css sont voisins : href="style.css".

A rule is struck through or a card overflows

A struck-through rule is often overridden by the cascade. For an overflow, inspect width, padding, image and overly long words. Test the fix on the smallest screen.

Contrôles : box-sizing, max-width: 100%, minmax(0, 1fr), overflow-wrap.

Self-assessment

Explain cascade, inheritance, padding and gap. Recreate a card without copying. Check that at 360 px the page stays readable and that focus is visible with the keyboard.

Je sais :
□ relier une feuille de style ;
□ cibler une classe ;
□ lire le modèle de boîte ;
□ écrire une media query ;
□ vérifier les styles calculés.
Remember :

Next: JavaScript will reuse the hidden form and the cards' data-* attributes.