I set the h2 element to blue, but i'm still having errors

Tell us what’s happening:

Your code so far


<style>
<h2 {color: blue;}>CatPhotoApp</h2>
</style>
<main>
  <p>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>
  
  <form action="/submit-cat-photo">
    <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>
  </form>
</main>

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 10323.67.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.209 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-css/use-css-selectors-to-style-elements

You can specify the css of an element in two ways.

  1. inline-css: The style should be inside the element like the following:

<h2 style="color: red">CatPhotoApp</h2>

Or

  1. Creating <style></style> and adding your css inside it (& also delete inline css):

If you want to add color red to the element first select it!

How to select it?

Look at the beginning of the tag and you’ll notice its name h2; write it between <style></style> and then open curly braces {} right after it just like in the following example:

<style>
      h2 {}
</style>

Until now, nothing will happen. I should specify the color which should be red by writing: color: red to make all h2 elements red like the following:

<style>
     h2 {
           color: red;
       }
</style>

The result: all headings of type h2 will become red.

The exercise want you to use the second method of <style></style> to turn all h2 into blue.

I hope this was helpful and good luck.

1 Like