-1

I want to know the purpose of using span container instead of div container. Where should i create the div and where the span.

I don't know. I just want the answer of my question.

1 Answers1

1

A div is a logical division of content, so it's better suited for grouping related content. A span is generally used to mark and/or style content within a larger block. A div is generally display: block by default, whereas a span is display: inline.

The snippet below demonstrates a very common usage:

.important {
  font-weight: bold;
  font-style: italic;
  color: red;
}
<div>
  Repellendus fuga <span class="important">facere quia perferendis</span> aut voluptas laboriosam ut provident distinctio soluta sint et.
</div>
ray
  • 26,557
  • 5
  • 28
  • 27