Text in HTML

Headings, paragraphs, emphasis (strong, em), quotations, code, abbreviations, superscripts and entities: choosing the tag by what the text means, not by how it looks.

  • 24 cards
  • 4 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

A few cards from the deck

  • Heading hierarchy: what is it?

    Show the answer

    The order of levels h1 to h6 that draws the outline of the page: an h1 for the subject, h2 for the parts, h3 for their subparts.

    Screen readers list the headings to navigate. Levels are not skipped (no h4 directly under an h2) and the level is chosen by the outline, never by the size wanted: size is set in CSS.

  • How many spaces does the browser display between "One" and "two"?

    ```html
    <p>One two</p>
    `

    • Just one
    • Ten, as in the code
    • None: the two words are joined
    • Two: one on each side
    Show the answer

    Just one

    HTML collapses any run of spaces and line breaks into a single space. To keep several, you need &nbsp; or a pre; to simply move two elements apart, set a margin in CSS.

  • The … tag forces a line break inside a paragraph, and the … tag marks a change of topic between two paragraphs.

    Show the answer

    The br tag forces a line break inside a paragraph, and the hr tag marks a change of topic between two paragraphs.

    Neither has content or a closing tag. br suits an address or a poem; not spacing between paragraphs, which is a job for CSS.

  • strong: what is it?

    Show the answer

    A tag that marks text as important, even urgent; browsers display it in bold by default.

    Bold is only the default look. strong carries a meaning screen readers can convey; b only makes text bold, with no added meaning.