<div> HTML Tag
Element ofHTML Document Structure Before And After HTML5 – Here’s What ChangedWhat does <div> HTML Tag do?The <div> element defines an arbitrary block of content which can be placed and styled as a single unit.DisplayblockUsagestructural
Just a block
The <div> element has no particular semantic meaning. It simply defines a block of content which can be styled as a single unit on a page. Prior to the semantic elements added in HTML5, it was the main structural element defining sections of an HTML Document. Today, there are a number of better structural elements which can be styled the same way as <div> elements, but add semantic meaning, identifying their purpose in the overall document. These include:
<header><nav><article><main><aside><footer><section>
Adoption of these semantic structural elements is not universal, but they are widely supported on browsers. So, while you will continue to see <div> elements in existing websites (and front-end frameworks like Twitter’s Bootstrap), you should use the newer elements whenever appropriate.
Attributes of div
| Attribute name | Values | Notes |
|---|---|---|
| align | Was used to specify the alignment of a div element. Deprecated. Use CSS instead. |