Learn Responsive Web Design by Building a Piano - Step 6

Tell us what’s happening:
“Your second .key element should also have a class of black–key.” Isn’t it correct how I’m doing it? Why don’t you take me as correct?

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Piano</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body>

<!-- User Editable Region -->

    <div id="piano">
      <div class="keys">
        <div class="black--key"></div>
        <div class="key"></div>
        <div class="key"></div>
        <div class="key"></div>
        <div class="key"></div>
        <div class="key"></div>
        <div class="key"></div>
      </div>
    </div>

<!-- User Editable Region -->

  </body>
</html>
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36

Challenge: Learn Responsive Web Design by Building a Piano - Step 6

Link to the challenge:

Welcome to freeCodeCamp Forum.
You have only completed part of the instructions.
Here the main part of the instructions are again.
“you’ll add a second class value of black--key. Add this to your second, third, fifth, sixth, and seventh .key elements.”
You have only added to one .key not all of the ones listed.
I hope you find this helpful. Happy coding! :slight_smile:

1 Like

Yes, it is exactly what I did, in the code that I sent you can see only one, but because I tried in different ways, but none of them worked. Here I leave how I did it “RIGHT” but it still doesn’t work.


    <div id="piano">
        <div class="keys">
        <div class="black--key"></div>
        <div class="black--key"></div>
        <div class="key"></div>
        <div class="black--key"></div>
        <div class="black--key"></div>
        <div class="black--key"></div>
        <div class="black--key"></div>
      </div>

The directions say “ you’ll add a second class value of black--key

Meaning you should not have gotten rid of the original class, but added this class while keeping the other one as well

2 Likes

I think I had already tried that option, but it didn’t work either, and I just tried it, and it still doesn’t work… It keeps giving me the same error!

    <div id="piano">
        <div class="keys">
        <div class="keys" class="black--key"></div>
        <div class="keys" class="black--key"></div>
        <div class="key"></div>
        <div class="keys" class="black--key"></div>
        <div class="keys" class="black--key"></div>
        <div class="keys" class="black--key"></div>
        <div class="keys" class="black--key"></div>
      </div>

Its failing because thats not how you add multiple classes. You can read how to do that here

Find the how to assign multiple classes section in that article

1 Like

I did not find the solution in that document, but it helped me understand the slogan.
Doing some research, I learned that multiple “class” values can be inserted by separating them with a space, thanks, I fixed the problem.

I got something like this:

<div id="piano">
    <div class="key">
    <div class="key black--key"></div>
    <div class="key black--key"></div>
    <div class="key"></div>
    <div class="key black--key"></div>
    <div class="key black--key"></div>
    <div class="key black--key"></div>
  </div>

¡Thanks you all!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.