Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialwebfxinteractive
Courses Plus Student 39,892 PointsWhich 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
Muaaz Matwadia
Full Stack JavaScript Techdegree Graduate 19,327 PointsHi,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.