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 trialBecca Rhew
1,508 PointsCan someone tell me what I am doing wrong here?
Screenshots: https://snag.gy/bs5r7J.jpg https://snag.gy/4WN1yu.jpg
<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>
Becca Rhew
1,508 PointsError message: Bummer! Your <div> elements need to both have 'class' attributes.
4 Answers
ianuweocrs
6,958 PointsHi ! Both of those div are not closed :
<div class="favorite_stuff">
Becca Rhew
1,508 PointsHi there--I thought that it was closed at the end? (see where I typed HERE)
<div> <div class="favorite_stuff"> <h4>Favorite Foods?</h4> <input name="food[]"> <input name="food[]"> <input name="food[]"> <input name="food[]"> </div> <--HERE
fractured2k
8,423 Pointsyou have two divs one <div> and <div class="favorite_stuff"> the <div> is closed the <div class="favorite_stuff"> is not closed
ianuweocrs
6,958 PointsYes, it closes the last div element, but you've to repeat the closing tag for each div element declared
You probably meant to do something like :
<div class="favorite_stuff">
<h4>Favorite Foods?</h4>
<input name="food[]">
<input name="food[]">
<input name="food[]">
<input name="food[]">
</div>
or
<div>
<div class="favorite_stuff">
<h4>Favorite Foods?</h4>
<input name="food[]">
<input name="food[]">
<input name="food[]">
<input name="food[]">
</div>
</div>
fractured2k
8,423 PointsLooks like you already have div a above your "<div class="favorite_stuff">" and the "<div class="favorite_stuff">" isn't closed
Becca Rhew
1,508 PointsI'm sorry, but I don't follow what you are saying (I am a total beginner!) :( Can you specify where it should go?
fractured2k
8,423 PointsThis should work what I did is I took out the <div> above your <div class="favorite_stuff">
<h1>First Day of School</h1>
<form>
<!--DELETED THE EXTRA DIV THAT WAS HERE-->
<div class="favorite_stuff">
<h4>Favorite Foods?</h4>
<input name="food[]">
<input name="food[]">
<input name="food[]">
<input name="food[]">
</div>
<!--DELETED THE EXTRA DIV THAT WAS HERE-->
<div class="favorite_stuff">
<h4>Favorite Animals?</h4>
<input name="animal[]">
<input name="animal[]">
<input name="animal[]">
<input name="animal[]">
</div>
</form>
</body>
Becca Rhew
1,508 PointsDeleting the <div> above each element did the trick! I understand what I did wrong now. Thanks a million, y'all!!
fractured2k
8,423 PointsNo problem! if you nee more help you can @ me on twitter @Fractured2K glad to help :)
Becca Rhew
1,508 PointsCool, will do!
Becca Rhew
1,508 PointsBecca Rhew
1,508 PointsThe challenge task: We want the same CSS style to apply to both <div> elements. Give both <div> elements the class of "favorite_stuff". Hint: The syntax for giving a <div> a class looks like this: <div class="favorite_stuff">