HTML Div Tutorial | What Is HTML Div?

  • Post category:HTML
  • Post author:
  • Post last modified:June 14, 2021
  • Reading time:2 mins read
You are currently viewing HTML Div Tutorial | What Is HTML Div?

HTML Div

In HTML <div> tag represents a section or a division. This tag is mostly used for creating a block or grouping HTML elements and add style all at once. It is used for creating the header, footer, and sidebar. With the help of the div tag, we can design the better layout of our document.

  • The div tag create a section in a webpage.
  • The div tag divided a webpage in different section.
  • It helps the proper positioning of HTML elements.

Create a Section

With div tag you can create a section in HTML document. when you create a division it must be define it with its width, height and background-color unless it will be hidden

<!DOCTYPE html>
<html>
<head>
<style>
div{
width:250px;
height:100px;
background-color:grey;
}
</style>
</head>
<body>
<div>

</div>
</body>
</html>

Result

Different Different Section

The Div tag is used for grouping elements in a different section like header, container, sidebar, and footer.

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div> As a Header...</div>
<div> As a main container... </div>
<div> As a side bar...</div>
<div> As a footer...</div>
</body>
</html>

Ashim Khatua

Professionally Web Developer since 2015, And also a Blogger. I am the founder of SiteCodings.com. I love to share my knowledge, which I earned the past few years. I want to share my knowledge with you through my Blog. Keep Reading.

Leave a Reply