Cyber Code Academy
Tutorials Academy Courses
Home / CSS / CSS Colors and Backgrounds

CSS Colors and Backgrounds

Color formats

.named { color: tomato; }
.hex { color: #2563eb; }
.rgb { color: rgb(37 99 235); }
.hsl { color: hsl(221 83% 53%); }

Choose color values that provide sufficient contrast between text and its background.

Background properties

.hero {
  background-color: #f1f5f9;
  background-image: linear-gradient(120deg, #dbeafe, #fce7f3);
  background-position: center;
  background-size: cover;
}

Practice

Create a hero section with a background color, a heading, and readable text contrast.

Want to learn this professionally?

Explore practical IT training at Cyber Code Academy.

View Academy Courses