DIV TAG IN HTML

The '<div>' tag in HTML is a versatile container used to group and structure content within web pages. It serves as a block-level element, facilitating organization and styling through CSS, aiding in accessibility, and enabling dynamic manipulation via JavaScript. With attributes like id, class, and style, <div> elements offer flexibility for developers to create well-structured layouts while maintaining semantic integrity in HTML documents.

  • Example of Div Tag :
  • Example-1
  • <!DOCTYPE html> <html> <head> <title></title> </head> <body> <div style="background-color:lightgreen"> <h3>PBA INSTITUTE</h3> <p>LOCATION : HOWRAH NEAR KOLKATA</p> </div> </body> </html>
    Output :

    PBA INSTITUTE

    LOCATION : HOWRAH NEAR KOLKATA

  • Example-2

  • <!DOCTYPE html> <html> <head> <title></title> </head> <body> <div style="background-color:lightgreen"> <h1>Advance Computer Coaching (PBA INSTITUTE)</h1> <address> Address: 54/2/4/1, Danesh Shaikh Ln <br> B Shalimar Area, Shalimar, Howrah<br> West Bengal 711103<br> Phone No:92394 12412 </address> </div> </body> </html>
    Output :

    Advance Computer Coaching (PBA INSTITUTE)

    Address: 54/2/4/1, Danesh Shaikh Ln
    B Shalimar Area, Shalimar, Howrah
    West Bengal 711103
    Phone No:92394 12412

    In this example, the <address> tag contains the PBA INSTITUTE's address and phone number.

  • Conclusion :
  • Basically, the <div> tag in HTML is like a building block for web pages. It helps developers organize content neatly and make it easy to understand. By using <div>, developers can keep their code tidy and make websites work well on different devices. It's kind of like a toolbox for creating cool and attractive web pages. When developers use <di>> wisely, it makes designing websites easier and ensures that visitors have a good time browsing around.