Definition:
The <div> tag defines a division or a section in an HTML document.
The <div> tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript.
The <div> tag is easily styled by using the class or id attribute.
Any sort of content can be put inside the <div> tag!
Note: By default, browsers always place a line break before and after the <div> element.
Program:
Output:
The <div> tag defines a division or a section in an HTML document.
The <div> tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript.
The <div> tag is easily styled by using the class or id attribute.
Any sort of content can be put inside the <div> tag!
Note: By default, browsers always place a line break before and after the <div> element.
Program:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>HTML DIV TAG</title> <style> .myDiv { font-family: Arial, sans-serif; border: 5px outset red; background-color: lightblue; text-align: center; } </style> </head> <body> <div class="myDiv"> <p> Atharva Agrawal IG: @theatharvagrawal </p> </div> </body> </html>
Output: