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 trialGrace Ji
5,402 Pointssection vs div
what is difference between section and div?
2 Answers
Konstantinos Pedarakis
21,301 PointsThere is no a major difference between the two as far as the Document Object Model is concerned, meaning you can achieve what you want by either using a div or a section. But.... a div is a generic container that could represent anything, used for grouping elements for styling purposes in most of the cases while a section represents a generic section-grouping of the document typically containing a heading as well. it has more semantic meaning.
Hope that helps. :)
Alexander Davison
65,469 PointsI'm not 100% sure (must've coded in Python & Ruby too long lol), but I do know that divs
are like boxes and are used more often than section
s.
Grace Ji
5,402 PointsThank you Alexander!
Grace Ji
5,402 PointsGrace Ji
5,402 PointsThank you Konstantinos!