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 HTML Basics Structuring Your Content Grouping Content with <main> and <div>

Tom Vinkovich
Tom Vinkovich
1,633 Points

I'm a little confused what a wrapper does compared a tag? Do they do the same thing? Why is it important to have both?

I apologies in advance if this is redundant. I simply cannot conceptualize! Please advise!

3 Answers

Sorry if I don't answer this correctly, but I think you've got it a bit confused. Tags, at least in html, is like the code you use to designate particular items. For example, a <p> tag would denote a paragraph.

<p>paragraph</p>

Now, wrapper tags, are tags do not necessarily have a function. What they do is help you differentiate between lines of code when you're reading the code. For example, you might have an <h1> tag and a <p> tag that's going to be about one section, while you have another <h1> tag and <p> tag that's about another section. You would use the <div> tag to differentiate between the two. Essentially, all they do is organize the code into sections. For example, here:

<div>
   <h1>Section 1</h1>
   <p>blah bah blah</p>
</div>
<div> 
   <h1>Section 2</h1>
   <p>blah blah blah</p>
</div>

It is basically simply for your use to understand and organize your code better. <main> tags works the same way, except it is for denoting the main body of your code, and is recommended to be used only once, for reduced confusion.

You're welcome! If you feel that this completely answers your question, you can mark this as Best Answer so that people know that this question is answered! I do hope my answer helped!

Tom Vinkovich
Tom Vinkovich
1,633 Points

Oh! Awesome! Yes, now it makes sense! Thank you so much for the feedback!