color

lets take a look at the color property

color is the CSS property that controls the color of your text content and also SVG shapes.

taught by Tina May

color can be set with CSS color names

You can use one of the 147 predefined CSS color names. The options are a bit limited, so you generally use this just for playing around with code.

color:

Tip: All 147 color names and visual examples can be seen here.

Oh hey there fellas!

What's brewing, good looking?

You miss 100% of the shots you never take.

color can be set with HEX codes

You can use hexadecimal (HEX) color code, the universal six-digit code used to define over 16 million color options. Remember that it always begins with the # symbol.

color:

Tip: Each digit represents a value from 0 to 9 and A to F, and it accepts both uppercase and lowercase.

Oh hey there fellas!

What's brewing, good looking?

You miss 100% of the shots you never take.

color can be set with RGB values

You can use any rgb() values, which represents red, green, and blue. Each of them can have a value between 0 to 255.

color:

Tip: Setting all three codes to the same value will give you shade of grey and you can increase/decrease this to make it lighter/darker, or tweak the tone slightly.

Oh hey there fellas!

What's brewing, good looking?

You miss 100% of the shots you never take.

explore all typography properties

Select any property below and we’ll show you step-by-step how to use the property, with video demo, tips and practical examples you can code for yourself.

color

font-family

font-size

font-style

font-weight

font

letter-spacing

line-height

list-style

text-align

text-decoration

text-indent

text-overflow

text-shadow

text-transform

vertical-align

word-spacing

Try it for yourself

HTML

<div>
  <h2>Oh hey guys!</h2>
  <p>What's brewing, good looking?</p>
</div>

Oh hey guys!

What's brewing, good looking?

CSS

/* Change your heading color*/

h2 { color: HotPink; }

/* Change your paragraph color*/

p { color: rgba(81, 62, 201, 0.75); }

reults

Try changing the color of each of the following elements. Below we’ve put a heading and a paragraph so test out what happens when you give them a HEX, RGB or HSL values, or one of the 147 color names.

Try these (or anything else!):

Copyright 2023