0Pricing
HTML Academy · Lesson

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

  1. Headings h1-h6 and Their Hierarchy
  2. Paragraphs em strong and b i
  3. br hr blockquote and pre
  4. The span and div Elements
← Back to HTML Academy