All subjects · Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript

Block and inline elements and content models

Edexcel IAL Information Technology · WIT12 3 hour practical exam on web development with HTML, CSS and JavaScript

How an element sits on the page depends on whether it is block-level or inline, and what it may contain depends on its content model (spec 7.2.1 and 7.2.2).

Practise this in the app: instant marking and a fix for every mistake. Free, no email needed to start.

Practise this lesson

Block-level and inline (7.2.1)

A block-level element starts on a new line and, by default, stretches to the full width available: <h1> to <h6>, <p>, <div>, <ul>, <ol>, <li>, <table>, <form>, <header>, <section>.

An inline element sits within the flow of text, only as wide as its content, without starting a new line: <a>, <span>, <em>, <strong>, <img>, <input>, <abbr>.

<p>Book a <strong>swimming</strong> lesson <a href="book.html">online</a>.</p>
<p>Each paragraph starts on a new line.</p>

The strong and a elements stay inside the first line of text; each p starts on its own line. CSS can change this with the display property (display: block, inline or inline-block).

Content models (7.2.2)

HTML5 groups elements into content models (categories) that say where an element may go and what it may contain:

Content modelMeaningExamples
FlowMost elements used in the bodyp, div, ul, table, form, a, img
SectioningElements that create a section with its own outline (headings belong to it)article, section, nav, aside
HeadingHeadings of a sectionh1 to h6
PhrasingText and the elements that mark up text inside a paragraph (mostly inline)span, em, strong, a, img, abbr, input
EmbeddedContent imported from another resourceimg, audio, video, iframe, canvas
InteractiveElements designed for the user to interact witha (with href), button, input, select, textarea, label

An element can belong to more than one model; img is flow, phrasing and embedded

Why it matters

A p element's content model is phrasing content, so a p cannot contain a block such as a div, ul or another p. Browsers silently close the p early, which breaks styling. Interactive content cannot be nested inside other interactive content: no button inside an a. Valid nesting is checked by a code validator (Topic 10).

Worked example

Explain what happens to the layout of this line: `<p>Prices: <span>Adult 5.00</span> <div>Child 3.00</div></p>`

  1. span is inline, so 'Adult 5.00' stays on the same line as 'Prices:'.
  2. div is block-level, so 'Child 3.00' starts on a new line and takes the full width.
  3. A p may only contain phrasing content, so the div is not allowed there: the browser ends the paragraph before the div, and the closing tag is left unmatched.

Answer: The div starts a new line and is invalid inside the paragraph; use an inline element such as span instead.

Key idea: Block elements start a new line and fill the width; inline elements flow with the text. Content models (flow, sectioning, heading, phrasing, embedded, interactive) define where elements may go: a p holds phrasing content only.

Check yourself

  1. Which of these elements is block-level by default?
    • `<li>`
    • `<span>`
    • `<em>`
    • `<a>`
    Show answer

    `<li>`. li is a block-level list item; span, em and a are inline.

  2. Describe how a block-level element is displayed by default.
    Show answer

    It starts on a new line and takes up the full width available.. Two features to give: it starts on a new line, and it takes up the full width available.

  3. Which content model does the video element belong to, as well as flow content?
    • Embedded
    • Heading
    • Sectioning
    • Metadata only
    Show answer

    Embedded. video imports media from another resource, so it is embedded content.

  4. Which of these is phrasing content that may go inside a p element?
    • `<ul>`
    • `<div>`
    • `<table>`
    • `<strong>`
    Show answer

    `<strong>`. strong marks up text within a paragraph: phrasing content. ul, div and table are block flow content and are not allowed inside p.

  5. Which content model includes button, select and a element with an href?
    • Embedded
    • Interactive
    • Sectioning
    • Heading
    Show answer

    Interactive. These are designed for the user to interact with.

  6. Which generic inline element is used to group words so that they can be styled, when no semantic element fits? Type its name without angle brackets.
    Show answer

    span. span is the generic inline container; div is the generic block container.

Practise with instant feedback

Sources

Last updated 8 November 2026. Spotted a mistake? Tell us.