HTML div Tag specifies a separate section or an area for the content of the web page. The div term stands for division which also explains purpose of div tag.
Table of Contents
Syntax of HTML div Tag
The Syntax of HTML div Tag is shown below, It has both starting and ending tags.
<div><p>This is content of div tag.</p></div>
Usage of HTML div Tag
HTML div Tag is used to create a separate division or an area where you can put any type of html content.
HTML div tag is also known as the container for the content of a web page.
HTML div tag is a block level element and it always starts from the next line.
The height of div tag depends on the height of the content, however you can change it's properties like height, width, background-color using CSS.
Example of HTML div Tag
Simple example of HTML div Tag is shown below.
<div>
<h3>HTML Div Tag</h3>
<p>HTML div tag is a container for the content of web page.</p>
</div>
Output
The output of above HTML code is shown below.
HTML Div Tag
HTML div tag is a container for the content of web page.
Browser Support for HTML div Tag
HTML div Tag is supported by all major browsers including Safari and Internet Explorer.
Global Attributes Support in HTML div Tag
The HTML div Tag supports all Global Attributes.
Event Attributes Support in HTML div Tag
The HTML div Tag supports all Event Attributes.
HTML div Tag Video
Watch our video on HTML div Tag and subscribe our Youtube Channel.