HTML <div> Tag



HTML has various tags such as < img> tag for displaying images, < a href> tag for linking,< b> < i> for text formatting etc.<div> tag is one of them.It is used to define a section or division of a webpage.

HTML < div> Tag

< div> tag defines a section of a document and is used to style the corresponding section separately.
The block or set of lines defined by <div> tag can be styled using CSS.
Here is an example:

<div style="font-size:20px; font-color:blue">
The text is 20 pixels in size and color is blue.
</div>
<div id="heading">
  <h3><div> Tag In HTML</h3>
</div>
 

The browser would display-

The text is 20 pixels in size and color is blue.

< div> Tag In HTML



As < p> tag makes a para, < h1> tag makes a heading similarly <div> tag makes a block or division.

CSS Tutorial for Beginners

Note:< div> tag is used often by browser and is separated by line breaks< br/>
Tip:< div> tag is used along with CSS to define layout of a page.