DIV (<div>) Tag

by Jai 28-Jun-19

0 354


In HTML, <div> tag permits users to specify a structural section or division in HTML document. You can easily bind together the sections of HTML elements and format them though CSS. You can make use of different attributes such as id, class, style and many more. Div tag has both opening (<) as well as closing (>) tag and it is mandatory to close the div tag.

Through <div>, one can easily use a particular section for a particular data or function due to this feature. It is widely used tag in web development.

Program:

<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of HTML div tag</title>
<style type="text/css">
.welcome-you-box{
background:#CA3939;
border:1px solid #333333;
color:#fff;
}
.welcome-you-box h1, .welcome-you-box p
{
padding: 10px 30px;
}
</style>
</head>
<body>
<div class="welcome-you-box">
<h1>Welcome</h1>
<p>Hi, welcome to our website codingtag.com</p>
</div>
</body>
</html>

Output:

DIV (<div>) Tag


Share:


Comments

    Waiting for your comments

Leave a Reply