Change the <h2> color to red

Tell us what’s happening:
I need to change the color of the

element to red, and i’ve been trying but maybe i add some code wrong and it doesn’t read …
I need help please

Your code so far


<style>
class= red-text {
   color: red;
 }
</style>
<h2 class="red-text">Catphotoapp</h2>
<main>
<p>Click here to view more <a href="#">cat photos</a>.</p>

 <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>

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

 <form action="/submit-cat-photo">
   <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>
 </form>
</main>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0.

Challenge: Use a CSS Class to Style an Element

Link to the challenge:

hint: if you want to style a par using

.toleft{ text-align:left; }
your html should be

<p class="toleft">
text
</p>

This challenge has two parts:

Part 1:

Inside your style element, change the h2 selector to .red-text and update the color’s value from blue to red .

You’ve got a small issue here.

<style>
thisIsTheSelector {
  // Body of class goes here;
  }
</style>

The syntax highlighting is showing that something is wrong with your rule, and it’s your selector!

Part 2:

Give your h2 element the class attribute with a value of 'red-text' .

This one you got!

I get it…
Thanks so much!
I was struggling :grin:

1 Like