FCC Basic CSS


1 Change the Color of Text Passed

Now let's change the color of some of our text.

We can do this by changing the style of your h2 element.

The property that is responsible for the color of an element's text is the color style property.

Here's how you would set your h2 element's text color to blue:

style="color: blue;">CatPhotoApp>

Note that it is a good practice to end inline style declarations with a ; .

2 Use CSS Selectors to Style Elements Passed

With CSS, there are hundreds of CSS properties that you can use to change the way an element looks on your page.

When you entered 

CatPhotoApp

, you were styling that individual h2 element with inline CSS, which stands for Cascading Style Sheets.

That's one way to specify the style of an element, but there's a better way to apply CSS.

At the top of your code, create a style block like this:

>
>

Inside that style block, you can create a CSS selector for all h2 elements. For example, if you wanted all h2 elements to be red, you would add a style rule that looks like this:

>
  h2 {
    color: red;
  }
>

Note that it's important to have both opening and closing curly braces ({ and }) around each element's style rule(s). You also need to make sure that your element's style definition is between the opening and closing style tags. Finally, be sure to add a semicolon to the end of each of your element's style rules.

3 Use a CSS Class to Style an ElementPassed

Classes are reusable styles that can be added to HTML elements.

Here's an example CSS class declaration:

>
  .blue-text {
    color: blue;
  }
>

You can see that we've created a CSS class called blue-text within the