H2 Element Selector Blues

<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }
h2   {
  font-family:Lobster, Helvetica;
}
  p {
    font-size: 16px;
    font-family: monospace;
  }
</style>

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

So this assignment asks - Import the Lobster font to your web page. Then, use an element selector to set Lobster as the font-family for your h2 element - I thought that my code does exactly what was asked and indeed the h2 phrase - Cat Photo App - is rendered in the Lobster font. But apparently the assignment is incorrect due to this comment - You should only use an h2 element selector to change the font - huh? I thought my code does just that so what am I missing here?

The challenge only tells you what family name to use, but you have added a generic name.

My code says - set the font for h2 as Lobster - which as far as I understand is the font name. Where in my h2 CSS line have I used a generic name?

Where did “Helvetica” come from?

I thought that when it came to specifying a font that you wanted to use, it was a good idea to list a second (which I have done with Helvetica) and third (which I have not done) choice. I guess I should have also specified a generic (serif, sans-serif, monospace) fallback but I forgot to do so.

font-family: FAMILY_NAME, GENERIC_NAME; .

The GENERIC_NAME is optional, and is a fallback font in case the other specified font is not available. This is covered in the next challenge.

Although this challenge tells you how to use a generic name in font-family, it doesn’t specify which one to use for Lobster, which is why your test is failing.

Aha ! (light bulb goes on!) So the point then is that, at least for the purposes of this excercise, we DON’T use a generic when using the
font-family attribute. We simply use
h2 {font-family: Lobster;}
I passed the excercise finally, using this line of code but I think that I should have passed with
h2 {font-family: Lobster, Helvetica;}
as well since it did give the font output on the web page that was desired
Screen Shot 2020-12-22 at 7.48.48 PM

Good job working through it.
The hard thing about programming isn’t that computers are smart, it’s that computers are stupid. They only do exactly what we tell them to and only if we tell them exactly the right way. This is why some of the tests will be overly specific when it comes to implementation; it’s just really difficult to write programmatic tests that behave logically.

So I am learning with a bit of frustration🙃
It is fun though overall - thanks for your help with this.

Frustration is definitely part of the process. I’m glad that you’re able to have fun despite it. Happy coding!