Introduction:

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.

Description:

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.

 

<!DOCTYPE html>
<html>
<head>
    <title>This is the example of div tag</title>
</head>
<body>
    <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>
    </div> 
</body>
</html>

Output:

 how to use div tag in html and css with example

I hope this article will help to you after reading.

0 comments


Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like