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.
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.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.
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:
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.