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 How to Make a Website CSS: Cascading Style Sheets Use ID Selectors

Mention ID in While Closing div

Do we not mention the id while closing a div, in this case no </div id="wrapper"> Since Nick didn't do it here, do I assume that we cannot have a div within another div since he didn't specify which div he closed?

2 Answers

Stone Preston
Stone Preston
42,016 Points

you dont add attributes to closing tags. so adding a div with an id called someId and closing the div would look like this:

<div id="someId">

</div>

i could have nested a div in it like so:

<div id="someId">

    <div class="someClass">

    </div>

</div>
Privado Coronel
Privado Coronel
13,504 Points

what i personally do is put closing comments on my divs so you wont be confused if you have a lot of nested divs like so: html <div id="someId">

<div class="someClass">

</div><!-- someClass closing -->

</div><!-- someId closing -->