In most of the books I've read on HTML5, they use <section> as a main container, and that then may have <article>'s inside it. I have also seen other tutorials that will show <article> as a main container for an article, or even a book, and then have <section> used as sections of the book (or sub sections). Anyone care to discuss the way they use them?

Example of the way I have used:


Recommended Answers

All 5 Replies

Article is defined as 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.

So I consider article to be used for a blog entry, or a news item here on DaniWeb.

The text for section says: 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. [...]

Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. A Web site's home page could be split into sections for an introduction, news items, and contact information.

Note: Authors are encouraged to use the article element instead of the section element when it would make sense to syndicate the contents of the element.

commented: :) +10

We used to just use the <article> element to represent our editorial content such as a news story or tutorial. However, I've been seeing it defined to include any content that could be syndicated, such as individual forum posts, and so we recently started doing that as well.

In html5 <section> element contain occupying some place of the website.
<article> element is nothing but the <p> element.

Mostly the paragraphs are contain inside the <section> element.

So should use the <article> element inside the <section> element. This is the best practice to use html5.

ComNaD, we do it the way you have outlined, but I have no idea if that's even correct. We use the <section> element to encapsulate all of the posts on the page (outside of the header/footer/sidebar/etc). And then we use <article> to denote each individual forum post. We take this a step further and use <header> within the article to denote the user information stuff and <footer> for the forum signatures.

Thank you guys to share this knowledge. I will check it out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.