Wednesday, December 28, 2016

what is the difference between div and span tags


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;’

No comments:

Post a Comment