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 trial

HTML How to Make a Website Adding Pages to a Website Add a New Page

section vs div

what is difference between section and div?

2 Answers

Konstantinos Pedarakis
Konstantinos Pedarakis
21,301 Points

There 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. :)

Thank you Konstantinos!

I'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 sections.

Thank you Alexander!