This post first appeared on hackinbits.com
<div> element is one of the famous block elements. It defines a section or division in an HTML document.<div> is a container element that is used to group the content, so that it can be styled easily using class or id attribute.
<div style="background-color:lightgrey"> <h3> I am a heading </h3> <p> I am a paragraph </p> </div>
<span> element is one of the famous inline elements. It is an inline container element that is used to group inline elements in the HTML document. The grouped inline elements can then be easily styled using class or id attribute.
<p>You are reading about <span style="color:red"> Inline and Block Elements.</span> </p>