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 trialStavros Sofroniadis
Courses Plus Student 1,503 PointsDifferences between <section> and <article> tag
Dear Friends,
if you could mention the differences between <section> and <article> tag & in which cases do we use each one.
If could mention an example would be better,
Thank You,
2 Answers
Steven Parker
231,198 PointsThe "section" is more generic. According to my favorite reference, MDN, the <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.
And the <article>
element:
...represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication). Examples include: a forum post, a magazine or newspaper article, or a blog entry.
Check the actual MDN pages (linked) for more details.
Stavros Sofroniadis
Courses Plus Student 1,503 PointsThank You,
Regarding "section" it is used to group similar content. For instance, we may have a sport section in a news chanel, inside sport section we may have divided into smaller sections for:1)Basketball, Football,3)Voleyball etc
While "article" is considered an indepedantable part of the site that represent a specific topic about,
For instance in a news channel, an article will be considered an analysis of previous day basketball game between 2 teams. Its a specific analysis of how one team defeat the 2nd team - and thats all
While in a "section" is more broader concept,
Mention if am correct about the above,
Can we use an <article> tag inside a <section> tag or vice versa?
Steven Parker
231,198 PointsSteven Parker
231,198 PointsI'm curious about the down-vote. Would the person who placed that vote please leave a comment explaining what you found wrong with my answer, and what I might do to improve it? Thanks!