CSSCSS30 min read

CSS Colors

Understand colors deeply: names, hex, rgb, and when to use each. Learn how color affects user emotion and readability.

David Miller
November 22, 2025
4.9k102

Colors decide the feel of a website.

Ways to write colors

Color names

color: red;

Hex colors

color: #ff0000;

RGB

color: rgb(255, 0, 0);

Background color

div {
  background-color: #f5f5f5;
}

Real world meaning

  • blue → trust
  • green → success
  • red → warning
  • gray → neutral

UI example

Button with background color:

button {
  background: green;
  color: white;
}

Remember

  • Keep contrast readable
  • Avoid too many bright colors
  • Consistency matters
#CSS#Beginner