# What is the difference between HTML tags <div> and <span>?

JavascriptWeb DevelopmentFront End Scripts

Both <div> and <span> is used to define parts of a web page. The <span> element shows the inline portion of a document. The <div> elements show a block-level portion of a document.

A div is a block-level element and a span is an inline element.

The div should be used to wrap sections of a document, while use spans to wrap small portions of text, images, etc.

Here’s an example:

<div>Demo Text, with <span>some other</span> text.</div>

The <div> element is used while creating CSS based layouts in html, whereas <span> element is used to stylize texts.

Published on 07-Feb-2018 18:30:20