HTMLHTML Div and Span

<div> and <span> are generic container tags:

  • <div> is a block-level element (used for grouping sections)
  • <span> is inline (used for styling parts of text)
<div>
  <h2>This is a section</h2>
  <p>This paragraph is inside a div.</p>
</div>

<p>This is <span style=\"color:red\">red text</span> inside a paragraph.</p>