0

Difference Between Article Tag & Section

Which tag is nested inside of these two tags. Article Tag is Nested inside Section Tag is Correct Option or Section Tag is Nested inside Article Tag is Correct? For Example: <Body> <Main> <Article> <Section> <P></p> </Section> </Article> </Main> </Body> Or <Body> <Main> <Section> <Article> <P></p> </Article> </Section> </Main> </Body> Which Example is Correct? Explain in Details

1st Dec 2023, 4:23 AM
Vikas Raj
Vikas Raj - avatar
2 Answers
+ 3
You can search the forum for some older answers in this topic: https://www.sololearn.com/en/Discuss/2751100/please-tell-me-how-often-is-it-used-tag-article-tag-section-and-tag-aside-and-function https://www.sololearn.com/en/Discuss/1582505/article-in-side-section-section-in-article https://www.sololearn.com/en/Discuss/2282360/article-div There are some pretty good explanations and examples in this SO thread: https://stackoverflow.com/questions/7549561/section-vs-article-html5 In short, both approaches could be valid and possible. It largely depends on the actual content what you want to show on the page. What is the relationship between the parts of text, which you put in these containers. What is the page structure that you want to represent. The distinction is much better, compared to using only DIV elements. Definitions: https://html.spec.whatwg.org/multipage/sections.html#the-article-element The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content. The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading.
1st Dec 2023, 10:12 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Just to add onto Tibor Santa already in-depth answer, you can also inspect some popular pages on your web browser and see what they do. When I was making a social media clone, I inspected the elements of websites such as Reddit, Twitter and Google News to help me gauge how I wanted to organize the elements of my pages.
1st Dec 2023, 1:05 PM
Justice
Justice - avatar