In the WHATWG HTML specification it says regarding to the div element that we must strive not to use the div element.
It says:
Authors are strongly encouraged to view the div element as an element of last resort, for when no other element is suitable. Use of more appropriate elements instead of the div element leads to better accessibility for readers and easier maintainability for authors.
So what should we use instead of divs?
Use what makes sense for the structure of your document. If you’re writing an article, use the
articleelement. Defining segments within a document? Consider thesectiontag. Need to mark the header of a document? Use theheaderelement.Think about it, every document starts with semantically meaningful tags: We wrap our HTML document with the
<html>tag. Inside, we define a<head>and a<body>. Within the head we provide a<title>, perhaps a few<script>‘s, and link up some stylesheets with<link>or<style>.Since everybody follows these rules, it boggles the mind why they would abandon this consistency and favor the use of vague and semi-meaningless tags like
<div>to define crucial portions of their document.Contrast a document made up of vague and meaningless tags:
Pretty meaningless, right? Always use the right tool for the job.