I'm new to coding, and I don't understand what the error "You should only use an h2 element selector to change the font."

Tell us what’s happening:

  **Your code so far**

<link href="https://fonts.googleapis.com/css2?family=Lobster&display=swap" rel="stylesheet">
.red-text {
  color: red;
  font-family: 'Lobster', cursive;

p {
  font-size: 16px;
  font-family: monospace;

<h2 class="red-text">CatPhotoApp</h2>
<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>

  <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="https://freecatphotoapp.com/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>
  **Your browser information:**

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

Challenge: Import a Google Font

Link to the challenge:

The instructions state the following:

Then, use an element selector to set Lobster as the font-family for your h2 element.

Instead, your code uses a class named red-text to style h2 element.

So I made another one:

.red-text { color: red; } h2 { font-family: 'Lobster', cursive; } p { font-size: 16px; font-family: monospace; }

still didn’t work.

Hey, I just tried your code and for some reason the thing that’s breaking the test is the fallback font cursive. If you remove that, it works. I guess the question didn’t ask you to provide a fallback font, but that does sound like a frustrating error, especially since the error message doesn’t actually match the problem!

1 Like

Not sure why you are still trying to change the color of the h2 element with a class selector instead of an element selector as stated in the instructions.

I did so, but it still didn’t work. I think there’s a bug. I already changed the color and font syle using an element selector (h2). Still didn’t work, yesterday it did work but today when I opened and found out I forgot to submit, everything I did yesterday didn’t work.

I think yesterday it worked and I was able to submit but today I think it restarted again, I tried doing the same thing I did yesterday and it didn’t work at all.

h2 { color: red; font-family:'Lobster'; } p { font-size: 16px; font-family: monospace; }

It looks like you deleted the .red-text rule and moved the color: red to the h2 rule? The challenge is not expecting anything in the h2 rule other than font-family: Lobster;.

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