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

CSS

Are Div elements defunct with HTML5?

Are <div> tags now replaced with <section><nav><aside> elements in HTML5? What is current best practice in regards to this?

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi Jeremy Luscombe,

DIV elements are still 100% semantic and are valid still in HTML5, other elements such as section, nav & aside would only take the place of div when it makes sense semantically. For example, if I had a container with dynamic content on the left and a sidebar on the right - I would use the below structure in place of stock standard div elements.

<article>
  <section>
    <h2>Content heading</h2>
    <p>Text goes here</p>
  </section>

  <aside>
    Additional page information can go here
  </aside>
</article>

You simply need to justify the use of these elements based on their semantic value on a page.

Hope that helps.

Thanks Chris Upjohn, big help!