JavaScript Treehouse Club - MASH MASH - HTML Forms, Divs, and Inputs

We want the same CSS style to apply to both <div> elements. Give both <div> elements the class of "favorite_stuff".HUH?

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"> Bummer! Your <div> elements need to both have 'class' attributes.

I have no Idea what to do here.

index.html
<body>
  <h1>First Day of School</h1>

  <form>

    <div>
      <h4>Favorite Foods?</h4>
      <input name="food[]">
      <input name="food[]">
      <input name="food[]">
      <input name="food[]">
    </div>

    <div>
      <h4>Favorite Animals?</h4>
      <input name="animal[]">
      <input name="animal[]">
      <input name="animal[]">
      <input name="animal[]">
    </div>

  </form>

</body>

3 Answers

Matthew Long
Matthew Long
28,350 Points

Looks like it basically gives you the answer in the hint. It wants you to add class="favorite_stuff to both div elements:

<div class="favorite_stuff">
  // other elements are here
</div>

The next challenge is very similar. You will be adding type="text" to the inputs. Let me know if you need more help with this!

Edwin Buitrago
Edwin Buitrago
2,726 Points

You can use the same class name many times as long as you want to apply the same styles to an element. In this case adding the class= "favorite_stuff" to both divs will apply the same CSS styles. It's great for you not having to repeat your code many times if you want to apply same styles.

ok thanks