HTML DIV (<div>) Tag
0 2759
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 through CSS.
You can make use of different attributes such as id, class, style and many more. Div tag has both openings (<) 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 a widely used tag in web development.
Code:
<!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:
Share:
Comments
Waiting for your comments