Use CSS Selectors to Style Elements #1

Tell us what’s happening:
Why doesn’t this work for the Use CSS Selectors to Style Elements section??

  **Your code so far**

<style>
h2 {
  color: blue;
}
</style>
<h2> Cat Photo App </h2>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36

Challenge: Use CSS Selectors to Style Elements

Link to the challenge:

Hi, I checked the link to the challenge and they were using inline css in the code.

<h2 style = "color: red;"> Cat Photo App<h2/>

what you have above is css in a style tag  in order for the css to apply to your document you'd have to nest the style tag in a head tag like this.

<head>
 <style>
h2 { 
             color: blue;
  }
</style>
</head>

hope that helps

I just noticed it intialized all of the html I wrote

< head >
< style >
place code in here or apply style in the inline css
</ style>
</ head >

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

Hi @Eugene.y.jang !

Welcome to the forum!

When asking for help on the forum please provide your FULL code and not parts of it.

It makes it easier for people to test your code and find any errors in your code if you provide the FULL code.

With the little bit you gave us, it works on my end.
Assuming you didn’t mess with any of the other html it might be an issue with an extension.

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.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.