Can someone help me out?

Tell us what’s happening: I am stocked where my h2 element should have the class red-text and my style sheet to declare a red text red-text class and have it color set to red.

Your code so far


<p>Click here to view more <a href="#">cat photos</a>.</p>

<a href="#"><img src="" alt="A cute orange cat lying on its back."></a>

  <p>Things cats love:</p>
    <li>cat nip</li>
    <li>laser pointers</li>
  <p>Top 3 things cats hate:</p>
    <li>flea treatment</li>
    <li>other cats</li>

<form action="">
  <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
  <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
  <label><input type="checkbox" name="personality" checked> Loving</label>
  <label><input type="checkbox" name="personality"> Lazy</label>
  <label><input type="checkbox" name="personality"> Energetic</label><br>
  <input type="text" placeholder="cat photo URL" required>
  <button type="submit">Submit</button>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; rv:80.0) Gecko/20100101 Firefox/80.0.

Challenge: Use a CSS Class to Style an Element

Link to the challenge:

Hello and welcome back to the forums~!

Your h2 text is red in the preview window. However, you’ve applied the red colour directly to the h2 selector. Instead, you should apply the red colour to the .red-text class, and give the red-text class to your h2 element.

I have tried all possibilities i knew i need more explanations please.

This is a class selector. It applies the color: red-text; CSS value (red-text here is incorrect) to the class called red-text (which IS correct).

This h2 element should be given a class attribute with a value of "red-text".

The boilerplate has this set to blue. You should not change this (it demonstrates how class selectors override element selectors).

1 Like

Screenshot_2020-09-27 freeCodeCamp org(1)
What am i missing here?

Hi, sunnyjoe…
Maybe you should try this.

.red-text {color:red;}


You should refer the h2 red-text to the “red text” of .red-text {color:red;}

Hope this will help you…

Sorry my bad, this is the code

  .red-text {color:red;}
<h2 class="red-text">CatPhotoApp</h2>

I am not suppose to make it an inline…

okay… but I think you need to refer h2 to red-text code above it

How do i do that please?

I think u need to code this

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

Thank you. It is a success.

Glad to hear that. Your welcome :slight_smile:

1 Like

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

You can post solutions that invite discussion (like asking how the solution works, or asking about certain parts of the solution). But please don’t just post your solution for the sake of sharing it.
If you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.


Thankyou so much for ur advice. I’m so sorry for what I’ve done :pray:

1 Like

You were trying to help, which is great. :slight_smile:

1 Like

I am sorry about this i don’t know about