Comments and neat nesting
Cette page nécessite un navigateur récent (avec support SharedArrayBuffer). Veuillez mettre à jour Chrome, Edge, Firefox ou Safari vers la dernière version.
English
Comments
- A comment is a note for you, not for the reader.
- The browser ignores it — it never shows on the page.
- Write it like this:
<!-- this is a comment -->.
English
<!-- The header goes here -->
<h1>Welcome</h1>
<!-- TODO: add a photo below -->
English
Tags go inside tags
- HTML tags nest: one pair can sit inside another.
- A
<div>is a plain box you can put other things in. - Indent the inside tags a little, so the nesting is easy to read.

English
<div>
<h2>My card</h2>
<p>Some text inside the box.</p>
</div>
English
Common mistakes
- Tags must nest, not overlap:
<b><i>x</i></b>, never<b><i>x</b></i>. - A comment is
<!-- ... -->and is ignored by the browser.
English
Now you try
- Comments help you stay organised; nesting builds structure.
- Leave a comment, then nest a paragraph inside a
<div>.
Explorer
Neat nesting = the tree
Indentation in your HTML mirrors the parent/child tree.
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
Leave a note for yourself. Add a comment, like <!-- TODO: add a photo -->.
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
Put the paragraph inside a box. Wrap it in a <div> … </div>.
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
Group the recipe. Put the <h2> et the <ul> together inside one <div>, and indent them inside it.