Share on Google+Share on Google+

HTML5 div tag, Definition of <div> tag in html5

Advertisement
In this illustration we will introduce you about the <div> tag in html5. The <div> tag is used to define the section in html document.

HTML5 div tag, Definition of <div> tag in html5

In this illustration we will introduce you about the <div> tag in html5. The <div> tag is used to define the section in html document. We can group the element as a block by <div> tag and can be formatted using styles. The <div> tag offtenly use css for formatting.

Declaration syntax:

The declaration syntax of <div> tag is as follows:

<div>Element to be group</div>

 The elements to be grouped are written inside the <div> tag and must use oppening and closing tag.

Example:Div_tag.html.

<!DOCTYPE html>
<html>
  <head>
      <title>Example of div Tag</title>
  </head>
<body>
  <dl>
  <div style="color:red">
      <dt><b>Roseindia</b></dt>
      <dd> We work on java technology</dd>
    </div>
    <div style="color:green">
      <dt><b>MCA</b></dt>
      <dd> Master of Computer Application</dd>
    </div>
  </dl>
</body> 
</html>

Output:

Download This Example:



Difference between HTML5 and HTML4.01:

There is no element specific attribute in HTML5. In html4.01 this tag is used for defining the navigational section but in the html5 some new tags like <article>,<header>,<footer>,<aside> etc replaces the <div> tag have been introduced. We should use new tags as much as possible, the <div> tag must be used at last when other tag is not suitable.

Advertisements

Posted on: September 8, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.