CSS Class Code Challenge

The next step is to declare a property within your class' curly brackets. There are a couple hundred properties in which you can choose from to stylize your HTML, but in the end, you'll probably only use somewhere around 20-30 throughout your day-to-day development.

One property you'll definitely use is the color property, which determines the color of the text within your HTML.

A CSS property is declared by adding the property name followed by a colon, then stating what value you'd like the property to be set to, ended with a semicolon.

So if I were to set the .text-blue class to take a property that actually turns text blue, I'd write it like so:

.text-blue {
   color: blue;

Here, the CSS property "color" can be set in a number of formats:

  • Color name blue

  • Hexadecimal #00FF00

  • RGBA rgba(0, 255, 0, 1)

  • HSL hsl(240, 100%, 100%)

Any of these formats would successfully turn your text blue, how they work though is probably good to save for another lesson down the road.

For a complete set of what colors you can set the color property to, check out: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value.

You can also see a complete list of possible CSS properties you can use at: https://www.w3schools.com/cssref/

Write a CSS property for your .text-green class that sets its color to the keyword value green.


Providing the lift to launch your development career

© 2023 Chris Courses. All rights reserved.