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 trialSusan Stowers
1,297 Pointsadding div class
i think I'm doing this correctly, but I'm getting an incorrect message
<body>
<h1>First Day of School</h1>
<form>
<div>
<div class="favorite_stuff">
<h4>Favorite Foods?</h4>
<input name="food[]">
<input name="food[]">
<input name="food[]">
<input name="food[]">
</div>
<div>
<div class="favorite_stuff">
<h4>Favorite Animals?</h4>
<input name="animal[]">
<input name="animal[]">
<input name="animal[]">
<input name="animal[]">
</div>
</form>
</body>
3 Answers
Tyler Clark
11,702 PointsWhen you add a div class you don't need to create a new div element. The class goes inside of the original div element:
<div class="favorite_stuff">
<h4>Favorite Foods?</h4>
<input name="food[]">
<input name="food[]">
<input name="food[]">
<input name="food[]">
</div>
<div class="favorite_stuff">
<h4>Favorite Animals?</h4>
<input name="animal[]">
<input name="animal[]">
<input name="animal[]">
<input name="animal[]">
</div>
Susan Stowers
1,297 PointsHi Tyler,
That's what I thought I did, I had just added it inside the original div element. It looks like you removed the <div> tog and replaced it with div class?
Tyler Clark
11,702 PointsClasses / ids are ways that you can name elements to give them specificity. You nest them inside of the opening tag of the element. So its not that I replaced the <div> tag, I just added the specifying information (class) into the opening tag. In your code snippet you are actually opening an additional div element (if you notice in the code challenge they provide you with the <div> elements). You don't have introduce a new line of code in order to specify the class. You did name assign the class name correctly :), you just need to move the class="favorite_stuff" up into the original div element.
Susan Stowers
1,297 PointsGot it, thank you!