The span and div Elements
Use generic inline and block containers for styling hooks.
Generic Containers
HTML has two generic, semantically neutral container elements:
<div>— a block-level container<span>— an inline container
They carry no meaning by themselves — they exist purely as styling and scripting hooks.
The div Element
<div> is a block-level container — it creates a new line before and after:
<div class="card">
<h2>Card Title</h2>
<p>Card content here.</p>
</div>
<div class="sidebar">
<p>Sidebar content.</p>
</div>
<!-- div groups related elements for CSS layout or JavaScript selection -->All lessons in this course
- Headings h1-h6 and Their Hierarchy
- Paragraphs em strong and b i
- br hr blockquote and pre
- The span and div Elements