Change the Color of Text <h2> to red

Tell us what’s happening:

Your code so far


<h2>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.">
  <h2 style="color: red;">CatPhotoApp</h2></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 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-css/change-the-color-of-text

The challenge tells you how to change the h2 element’s color to blue:

<h2 style="color: blue;">CatPhotoApp</h2>

Adding a style attribute like this style="color: blue;" is how you change the color of an element.

Now, what do you think you need to do to make it red?

this is not what i want, i need

on it’s on to turn red, not adding red to it’s element

I’m not sure I understand. Are you looking for the solution to the challenge you provided the link to?

https://learn.freecodecamp.org/responsive-web-design/basic-css/change-the-color-of-text

Because that is what I’ve provided.

yes, but really i did what you asked. i still can’t bypass

You are doing more than the test asks. You created a new H2 and made it red. Clear your code and start over. Don’t add new things, only change existing code.

Hey there! I’ve literally just done this one (yay!)

It’s a bit confusing, but basically see it as telling the rest of the page to recognise what “.red-text” is.

You do this by telling the very top bit (in the <style> ... </style> section) what it has to do when you type “red-text” further down. See the section as a dictionary in this case.

your code should be this

/* this h2 element is what you care about*/

<h2 style="color:red;">CatPhotoApp</h2>

/*this one above this comment */

<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>
1 Like

Thanks all, it worked!

1 Like