CSS Class, styling the element,

CSS Class, styling the element,
0.0 0

#1

Hallo Guys,

I’m trying to complete on of the first task from the CSS/ HTML course. Maybe somebody can help me and can say how to do it right. .
I would be v thankfull! :blush:

I need to do this :

  • h2 element should be red. ( this is wrong in my code)
  • h2 element should have the class red-text. ( this is also wrong)
  • stylesheet should declare a red-text class and have its color set to red.
  • Do not use inline style declarations like style=“color: red” in your h2 element.

my code so far

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

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


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

Link to the challenge:


#2

Hello @Expertin,
Try the below code you will get the answer

<h2 class= “red-text”> your text </h2>

SOL: if you’re going to use style or class for a element you should also insert that class with the element like I did…

Ps: sorry for the bad English buddy!!


#3

Hey :smiley:

You should put the class inside of the tag like this.

<h2 class= "red-text"