Asking for help about thw code

Please. help me with this

<style>
  .red-text {color: red;
  }
  
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

What are you trying to do?

What’s the issue you’re having? If you’re trying to change the color of the<h2> element, you have the right code.

1 Like

I tried this code several times. But it didn’t work eventhough it is corrected

What is the name of the challenge? We need to know what the challenge is asking you to do, so we can check your code against the instructions.

If this is the ‘Change the Color of Text’ challenge, your code seems to be correct. I would suggest possibly doing it differently than in between style tags. That may be why it’s not passing you.

1 Like

Is the following link the challenge?

https://www.freecodecamp.org/challenges/change-the-color-of-text

1 Like

Yes it is. That’s the challenge.

Your code is using a class to style the color. The challenge wants you to use the style="" syntax, which is also known as inline-styling. You just need to move everything current between the { } in the h2 selector definition to be inside the “” of the style="".

The example did the same thing for the h2 element, but made the font color blue instead of red.

<h2 style="color: blue">CatPhotoApp</h2>
2 Likes