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

JavaScript JavaScript Basics (Retired) Working With Numbers Doing Math

what is the differentiate between div and section could you please explain me in brief in html and css

what is the differentiate between div and section could you please explain me in brief in html and css

1 Answer

Steven Parker
Steven Parker
231,268 Points

The HTML Content Division element (<div>) is the generic container for flow content. It has no effect on the content or layout until styled using CSS. As a "pure" container, the <div> element does not inherently represent anything. The <div> element should be used only when no other semantic element (such as <article> or <nav>) is appropriate.

The HTML <section> element represents a standalone section — which doesn't have a more specific semantic element to represent it — contained within an HTML document. Typically, but not always, sections have a heading. Do not use the <section> element as a generic container; this is what <div> is for, especially when the sectioning is only for styling purposes. Also note that a <section> element must not be a descendant of an <address> element.

For more details, see the MDN pages for div and section.