The structure of an HTML document

The fixed skeleton of a web page: doctype, html, head and body, the vocabulary of markup (element, tag, attribute, empty element) and the tree the browser builds from it.

  • 24 cards
  • 5 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. The numbers
  5. Scenarios

A few cards from the deck

  • HTML element: what is it?

    Show the answer

    A unit made of an opening tag, some content and a closing tag, such as <p>Hello</p>; <br> or <img> only have their opening tag.

    A page is a nesting of elements. Do not confuse the element (the whole <p>Hello</p>) with its tags (<p> and </p>).

  • What is wrong with this code?

    ```html
    <p>Ce texte est <em>très important</p></em>
    `

    • The tags overlap: </em> must come before </p>
    • em cannot be inside a p
    • The em is missing a class attribute
    • </p> must be placed after a line break
    Show the answer

    The tags overlap: </em> must come before </p>

    Elements must nest like Russian dolls: the last one opened is the first one closed. Here em opens inside p, so it must close before it: <p>This text is <em>very important</em></p>.

  • In a page, the … element holds information about the document (title, encoding, style sheets) and the … element holds what is displayed in the window.

    Show the answer

    In a page, the head element holds information about the document (title, encoding, style sheets) and the body element holds what is displayed in the window.

    Both are direct children of html, in this order. Nothing meant to be displayed belongs in head.

  • Tag: what is it?

    Show the answer

    Text between angle brackets that opens or closes an element: <h1> opens, </h1> closes.

    The closing tag repeats the name of the opening tag preceded by a slash. Only the opening tag can carry attributes.