HTML Block & Inline
Highlight only a person name inside a paragraph using span and a class.
Understand the topic
Elements have default display behavior, commonly block or inline, but CSS can change that behavior. A block box typically begins on a new line and uses available width; inline content participates in a line of text. Display behavior is different from HTML content rules. Making a div display inline does not make it valid inside a paragraph.
Worked example
<div style="border: 1px solid #64748b;">A block container</div>
<p>A sentence with <span style="background: #fef08a;">an inline highlight</span> inside it.</p>
The div groups a block of content. The span marks a portion of text without adding a new paragraph or semantic role.
Practice
Highlight only a person name inside a paragraph using span and a class.
Show a suggested answer
<p>Welcome, <span class="person-name">Kojo</span>.</p>Common mistake
Do not confuse CSS display with meaning. Choose the correct element and valid nesting before adjusting layout.