FCC Challenge 11: Style Multiple Elements with a CSS Class

In FCC Challenge 11 we need to apply the red-text class to the h2 and p elements:

<style>
  .red-text {
    color: red;
  }
</style>

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

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

The modified code should look like:

<style>
  .red-text {
    color: red;
  }
</style>

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

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

Remember that you can attach classes to HTML elements by using class=”your-class-here” within the relevant element’s opening tag.

Remember that CSS class selectors require a period at the beginning like this:

.blue-text {
  color: blue;
}

But also remember that class declarations don’t use a period, like this:

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

Apply the red-text class to your h2 and p elements.

Leave a Comment