Style element for color

Tell us what’s happening:
hi guys, in my opinion my answer is not correct but it’s accepted. I don’t understand why? I didn’t write opening tag for h2 and as u see there are 3 h2.
Your code so far

h2 {color:blue;}
<p>Click here to view more <a href="#">cat photos</a>.</p>

<a href="#"><img src="" 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="">
  <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 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5.

Challenge: Use CSS Selectors to Style Elements

Link to the challenge:

HI @SARA1985

Withing STYLE tags, the h2 is a CSS selector thus you only need one.

1 Like

hi, thank u . but we don’t need to insert < before h2 inside the style tag?

Hi @SARA1985!

The code you have shared works on my end. Please ensure that you have disabled any extensions that interface with the freeCodeCamp website (such as Dark Mode and Ad Blocker), and set your browser zoom level to 100%. Both of these factors can cause tests to fail erroneously.

Also make sure that your browser is up to date.

1 Like

to write a css selector you write the name of the tag, the angular brackets are not eneded to target a tag

1 Like

Thaaanks. wanted to know CSS CLASS and CSS SELECTOR lessons want to explain the same usage for changing the color of text? I doesn’t make difference we use which one?

I am going to link mdn docs article on css selectors.

They give really good examples so you can see the different types of selectors.,the%20rule%20applied%20to%20them.

1 Like

Thanks for your help.