oldboot Posted July 26, 2015 Share Posted July 26, 2015 Have been trying to learn HTML5 but what confuses me is the use of the <section> and <article> elements. For example in some tutorials you see this: <section> <article> content </article></section> yet in other tutorials you see another way of using these elements: <article> <section> content </section></article> Could someone tell me if both examples are correct or if only one of the examples is correct. Thanks Link to comment Share on other sites More sharing options...
Ingolme Posted July 26, 2015 Share Posted July 26, 2015 They are both correct. A website may have a section containing articles, or an article may have multiple sections. You need to judge which is the way that best suits the content on your website. It's even OK to have a section containing articles where those articles are further divided into sections. Link to comment Share on other sites More sharing options...
oldboot Posted July 26, 2015 Author Share Posted July 26, 2015 Big thanks for the explanation Ingolme Link to comment Share on other sites More sharing options...
Ingolme Posted July 26, 2015 Share Posted July 26, 2015 I don't know if it's commonly known, but articles can have a header and footer as well. Such that the structure could be something like this: <article> <header> <h2>This is the News</h2> <p>Posted on <time datetime="2015-01-01">January 1st, 2015</time> by <b>Ingolme</b></p> </header> <section> <h3>Part 1</h3> <p>Multiple paragraphs</p> <p>Multiple paragraphs</p> </section> <section> <h3>Part 2</h3> <p>More paragraphs</p> </section> <footer> <h3>About the Author</h3> <p>The author of this article has been writing this article</p> </footer></article> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now