There is a difference in HTML <div> tag and <span> tag although both tags are used to show data in the HTML body. <div> elements are block elements in HTML and XHTML? and automatically appear on its own line. Here is the difference in the presentation in both tag. If you need to show data on the same line as other text then you can use <span> element instead of <div> element. The <div> element is the most popular, but it is a block element and takes up its own lines in the browser. If you want to place new text inline, use <span> tag.

Written by Bala Krishna

Bala Krishna is web developer and occasional blogger from Bhopal, MP, India. He like to share idea, issue he face while working with the code.