Div tag in HTML

The Div tag in HTML stands for Division tag .It is used to group HTML elements, which are subsequently given a container and given a CSS or JavaScript style. Let us know more about it :

Specifications :-

  • In an HTML document, the div tag designates a division or section.
  • Any sort of content can be put inside the tag.
  • The div tag has an opening (div) and closing (/div) tag, and closing the tag is manndatory.
  • The Div element is the most useful in web development because it allows us to divide out the data on a web page and create specific sections for different types of information or functions.
  • Div tag is block-level tag, thus the div tag contains entire width. Hence, every div tag will start from a new line, and not the same line.
  • For Example : Instead of coding the same style for each paragraph element, you might, for instance, wrap a collection of paragraph elements inside a div element to take advantage of CSS styles and apply font style to all paragraphs at once.

For Example :

<!DOCTYPE>
<html>
<head>
<title>Document</title>

<style>
div{
background-color:aquamarine;
font-size:50px;
border:2px solid black;
}
</style>

</head>  
<body>  
<div> Technocrat United </div>  
</body>
</html>  

Above is the example of how div tag help us in styling our elements using CSS.

Output :

Div tag in HTML

Note :-

Watch Div tag in HTML video on YouTube – Click here
HTML Lists – click here
HTML Text Formatting Tags :– click here