Press "Enter" to skip to content

Difference between div and span tags

The ‘div’ and the ‘span’ tags are quiet frequently used tags in HTML. The proper understanding of these tags are very much important for a web HTML developer.This article is shows what are the characteristics of both these tags.  Understanding the difference between both  tags will help to use them in appropriate place.

div Tag:

Following are the characteristics:

  1. As the name indicates, the div tag defines a ‘division’ in a web page.
  2. div is a block-element; its default display value is “block”.
  3. div tag is commonly used while creating Css based layouts in html.
  4. by default, a line-break is placed before and after this element.

span tag:

Following are the characteristics:

  1. span tag makes no visual difference in the page, unless customised with style attribute.
  2. span is an in-line element.
  3. span is commonly used to stylize texts. The in-line feature makes it easy to use custom styles without changing the layout.
  4. No line-breaks by default, but this can be achieved if we change its in-line nature by specifying in the style attribute to ‘display:block;’