In this article we are going to explain what is div tag in html or why use div tag in HTML or how to use div element in html with example.
The HTML <div> tag is used for defining a section of your document. With the <div> tag, you can group large sections of HTML elements together and format them with CSS.
We know that every tag has a specific purpose for example p tag is used to specify paragraph, <h1> to <h6> tag are used to specify headings but the <div> tag is just like a container unit which is used to encapsulate other page elements and divides the HTML documents into sections.
Let's see an example of div tag in HTML.
<title>This is the example of div tag</title>
<div style="border:1px solid pink;padding:20px;font-size:20px">
<p>Welcome to sqltutorialspoint.com,
Here you get tutorials on latest technologies.</p>
<p>This is second paragraph</p>
I hope this article will help to you after reading.Let's check live example