HTML div tag
Html <div> element is a block level element which contains the content or other elements. This element is nothing on its own. It is useful when used with class, title attributes.
<p>This block has content and may have other elements.It can be designed using css poperties.
Height and width can also be defined for it.</p>
<p>This is the secong block of content. This block can also be designed.</p>
Actually, it is used to style a group of its elements using CSS.The following example styles all paragarphs instead of styling the paragarphs separately.
<p>This block has content and may have other elements.The content inside div element is editable.</p>
It may also be used to set properties for more than one elements at a time. The following example sets the attribute contetneditable instead of individual paragraphs.
<p>This block has content and may have other elements.The content is being styled by the CSS properties.</p>
div should only be used when no other element is suitable for the content. For example, we use <nav> element for navigation bar. But div is a generic type element.
Both opening and closing tags are necessary for the div element.
All global attributes are applicable on div element.