div and span HTML Group Elements: Basic HTML

May 23, 2014
Basically, there are 2 html group tags in HTML elements. They are <div> and <span>. Div tag creates a section in a document with block level and as same the span tag creates section in html document in inline.
difference betweenn <div> and <span>

HTML Block Tags/ Elements:- Block Elements are those that occupied all the line that it is staying now. It means it normally starts or ends with new line when it is being displayed in any browser. Some examples are: <p>, <h1>, <table> <div> etc.

HTML Inline Tags/ Elements:- Inline tags displayed in the same line even starting a new tag. <img>, <a>, <span> etc tags are inline tags which don't break the line.

<div> Tag

So as HTML block element or tag, <div> is the block tag that is used to define section in html documents which groups all the elements of HTML. Simply it has no meaning but being a block tag it breaks a line before and after it. When it is being used with css, it has lots of attributes. Actually div tag replaces the old table tag for defining a document. Indeed table is used to show the data in tabular format.

<span> Tag

Span tag is same as the div tag which is used to create a section in html page but unlike the div tag, it is inline tag. <span> tag is mostly used for making text section.

Previous
Next Post »