Menu

Non-Semantic Tags: div and span

Non-Semantic Tags: div and span

div and span are generic containers. They do not carry any meaning about the content inside them. Their entire job is to group things together so you can style or organize them.

div is a block-level element, meaning it takes up the full width available and starts on a new line. span is inline, meaning it only takes up as much space as its content and stays in the flow of text.

<div class="card">

  <p>This is a card with some <span class="highlight">highlighted</span> text.</p>

</div>

Explanation: Here, div groups the whole card, while span wraps one word inside the paragraph so you can style it differently without breaking the sentence flow. Neither tag tells you anything about what the content actually means.


HTML Tutorial (From Basics to Implementation)

AP

Abhishek Pati





Get in Touch For Details