HTML & CSS · Junior · Question 4 of 75

How does <div> differ from <span> by default?

Explanation

<div> has display: block by default: it stretches to the full width of its parent and starts on a new line. <span> has display: inline: it flows within text and is as wide as its content. Neither carries semantics - both are containers for grouping and styling.

Further reading

Problem with a question

HTML & CSS · Junior · question 4

Test yourself

Take the HTML & CSS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz