Interview Question

What is the difference between <div> and <span>?

div groups larger blocks; span groups small inline content.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

`<div>` is a general block container; `<span>` is a general inline container. • A div normally starts on a new line. • A span stays inside the surrounding text. • Choose the option whose defined semantics and behavior match the task.

💡 Simple Example

<div class="card">Box</div><p>Hello <span class="name">Maya</span></p>

⚡ Quick Revision

div groups larger blocks; span groups small inline content.