Please explain <div> element. | Sololearn: Learn to code for FREE!

+1

Please explain <div> element.

12/25/2016 7:39:16 AM

Prateek Birthal

1 Answer

New Answer

0

The following explanation corresponds to the latest W3C specification for HTML5, and a bit of my notes: The <div> element is a SECTIONING element, equivalent to the <span> element in text-level semantics. It has no meaning at all, and authors are encouraged to use it as an element of LAST RESORT. It can be paired with the class, lang or title attributes. The use of more appropriate elements instead of <div> (such as <article>, <section>, <header>, <footer>, <nav>, etc.) leads to better accessibility for readers and easier maintainability for authors. Also, this element has been abused in previous versions of HTML, and it is still employed as a "box" around which styling can be applied. So, it ends up being used only for styling purposes. HOWEVER, there will always be a trade-off between SEMANTIC PURITY and AESTHETICS.