Section 1 - Instruction

So far, every tag we've used has a clear purpose, like <p> for paragraphs. But what if you just need a simple "box" to group elements together for styling or layout?

Engagement Message

Why might you want to group a heading and a paragraph together?

Section 2 - Instruction

For this, we use the <div> tag. Think of it as a generic container with no special meaning.

A <div> is a block-level element, meaning it takes up the full width of the page and starts on a new line, creating a "block."

Engagement Message

What does "block-level" suggest about how a <div> will appear?

Section 3 - Instruction

Here's how you might use a <div> to group a title and text into a single "card":

Later, you can use CSS to add a border or background to this entire <div> block.

Engagement Message

How does this grouping make styling multiple elements easier?

Section 4 - Instruction

But what if you don't want to group a big block, and just want to style a small piece of text inside a line? For that, we use the <span> tag.

A <span> is an element, wrapping text without breaking the flow of the line.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal