Help SheilynUse a CSS Class to Style an Element

Tell us what’s happening:

I’m being told to use the CSS Class to Style an Element, I’m just a bit confused on how I can get the h2 element to turn red.

Your code so far

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

<h2>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>

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/use-a-css-class-to-style-an-element

HTML is a Markup, while CSS is a sheet language that discribe the appearance of markups.

Meaning that the two use whole different language to accomplish things.

When you use the tag “style” in an HTML document, you summon a css code that will modify the appearance of the HTML elements.

To use CSS, you have to first declare what html element you want to modify ( in your case, the class “red-text”) and then tell write a code that will be placed between braces :

So you need to do the following :

.red-class{
    color : red;
}

and then apply this class to an HTML element, in your case the h2 :

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

so your whole code should look like this :


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

tell me if you have questions :slight_smile: