Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,692 Points

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