Span: the inline container, online
Six activities your students do on their own devices. See who's finished, and their scores.
Span: the inline container in one minute
What students need to know
<span> wraps '$42' without breaking the paragraph. The price stays inside the sentence flow. id="badge" gives this span a unique hook for CSS. Without CSS, <span> renders exactly like the surrounding text.
<span> has no built-in visual styling. All appearance must be added with CSS targeting its class or id. <span> is an inline element - it must live inside a block container like <p>, <h1>, or <li>.
Mistakes students make
- HTML tag names must be lowercase. <SPAN> should be written as <span>.
- The span closing tag is missing its forward slash. It should be </span> not <span> at the end.
- There must be no space between = and the opening quote. The correct form is class="bold".
- Closing tags must not contain attributes. The correct closing tag is simply </span>.
What students will learn in this module
Every question in Module 21
Quick questions
- Is <span> a block-level or inline element?ABlock-levelBInline
- True or false: <span> adds visible styling like colour by default.AFalseBTrue
- Where must a <span> be placed?AInside a block element like <p> or <h1>BOutside all block elements
- True or false: <SPAN> with capital letters is valid HTML.AFalseBTrue
- What is the key difference between <span> and <div>?A<span> is block-level; <div> is inlineB<span> is inline; <div> is block-level
Key terms
Students type the meaning of:
<span>
Match the pairs
<p>Hello, <span class="name">Alice</span>!</p>Match it to what it does<p><span class="red">Error:</span> file not found.</p>Match it to what it does<span> is an inline container - it stays in the text flow without starting a new lineMatch it to what it does<span> has no built-in styling - all appearance comes from CSS targeting its class or idMatch it to what it does<SPAN class="tag">Sale</SPAN>Match it to what it does<p>Label: <span class="val">10<span></p>Match it to what it doesFill in the blanks
<p>Hello, <___ class="name">Alice</span>.</p>
Hint: Type the inline container element name used to wrap a word
<p>Price: <span ___="bold">$9.99</span>.</p>
Hint: Type the attribute name used to assign a CSS class to this span
<p>The <span class="red">error</___> here.</p>
Hint: Type the element name for the closing inline container tag
<p><span class="a">One</span> <___ class="b">Two</span></p>
Hint: Type the inline element name that wraps the second word
<p>User: <span ___="username">Alice</span>.</p>
Hint: Type the attribute name used to give this span a unique identifier
Spot the error
Question 1
A<SPAN class="highlight">word</span>B<p>More text.</p>C<p>Last line.</p>
Question 2
A<p>Price: B <span class="price">$9.99<span>C</p>
Question 3
A<p>Hello,B <span class="name">Alice</span>C <span class= "bold">!</span>D</p>
Question 4
A<p>Status:B <span class="ok">Active</span>C <span class="count">5</span>D </span class="ok">E</p>
Question 5
A<p>Total cost:B <span class="currency">AUD</span>C <span class="amount">42.50</span>D <span class="note">inc. GST</span>E <span>extra<\span>
