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

HTML

angel angel
angel angel
6,620 Points

Why use <section> and <main> instead of <div>

So I being try to understand what is the differences of the following elements <div>, <Section> and <Main> ,and when to used what. For example : <body> <header> <div id="logo">hello</div> <nav>...</nav> </header> <main role="main"> <h1>Guitars</h1> <p>The greatest guitars ever built.</p>

<article>
  <h2>Ok today</h2>
  <p>...</p>
</article>

<article>
  <h2>Cool stuff</h2>
  <p>...</p>
</article>

</main> </body>

Also I don't understand how the elemet of <Div> works. Is any good tutorial out there on how works and and how I use it. Thank you so much guys for your help. I just a new programmer lost lol. You guys know that is the fun part of all lol. Thanks again!

1 Answer

Simon Coates
Simon Coates
28,694 Points

main, section etc are newer and have meaning. div is a generic block level container. see here for a prior discussion.