Which is better to use section or div?

In developing website, most of the time we do it per section. Now what is the difference between using section and div? for the main container of the wrapper?

1 Answer

Azzie Fuzzie
Azzie Fuzzie
Full Stack JavaScript Techdegree Student 15,222 Points

Hi,kariecraig Here is the difference hope that helps.

<section> The <section> element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content: — chapter — various tabbed pages in a tabbed dialog box — numbered sections of a thesis …

A Web site’s home page could be split into sections for an introduction, news items, and contact information. The section element is not a generic container element. The section element is appropriate only if the contents would be listed explicitly in the document’s outline. A section typically with a heading.

<div> The <div> element has no special meaning at all. It can be used with the class, lang, and title attributes to mark up semantics common to a group of consecutive elements. When no other element is suitable, the div element is used as an element of last resort. Otherwise, it leads to poor accessibility for reader.