HTML
HTML elements are divided into two groups namely BLOCK elements and INLINE elements.
A block elements is an element that always start on a new line and take up the entire width and any other element starting after it will start from the next line.
Div <div>
<div>
Form <form>
<form>
Heading tags
<h1> <h2> <h3> <h4> <h5> <h6>
<h1>
<h2>
<h3>
<h4>
<h5>
<h6>
Paragraph <p>
<p>
List
<ol> <ul> <dl>
<ol>
<ul>
<dl>
Horizontal Line <hr />
<hr />
Blockquote <blockquote>
<blockquote>
Preformatted <pre>
<pre>
Address <address>
<address>
An Inline elements is an element that not necessarily start on a new line and take up only the required amount of width.
Span <span>
<span>
Bold <b>
<b>
Italic <i>
<i>
Underline <u>
<u>
Subscript <sub>
<sub>
Superscript <sup>
<sup>
Big <big>
<big>
Small <small>
<small>
Emphasize <em>
<em>
Strong <strong>
<strong>
List item <li>
<li>
Citation <cite>
<cite>
Definition <dfn>
<dfn>
Insert <ins>
<ins>
Code <code>
<code>
Keyboard <kbd>
<kbd>
Variable <var>
<var>
We use two tags to group HTML elements namely the <div> tag and <span>.
The div tag is a block element that is commonly used to group different HTML elements to form a group.
Following is an example of div tag used to create an address container of user.
<!-- 1st user address container --> <div class="address-container"> <p>Mr. A Bc</p> <address> #123, 3rd Main Street, ABCD Layout, Bangalore, Karantaka 560001 </address> </div> <!-- address container ends here --> <!-- 2nd user address container --> <div class="address-container"> <p>Ms. X yz</p> <address> #99, 7th cross, 8th Main road, PQR Layout, Bangalore, Karnataka 560001 </address> </div> <!-- address container ends here -->
Output
Mr. A Bc
Ms. X yz
The span tag is an inline element that is commonly used to group different HTML inline elements to form a group.
Following is an example of span tag used to create some inline groups.
<p>This is a sample line having <span>a <strong>CAPITAL</strong> letters word</span> and <span>a <small>small</small> letters word</span>.
This is a sample line having a CAPITAL letters word and a small letters word.