</>
Skip to content
W3.CSS lessons (5/38)

W3.CSS — Colors

Basic Colors

W3.CSS provides built-in color classes:

<div class="w3-red">Red</div>
<div class="w3-blue">Blue</div>
<div class="w3-green">Green</div>
<div class="w3-yellow">Yellow</div>
<div class="w3-orange">Orange</div>
<div class="w3-pink">Pink</div>
<div class="w3-purple">Purple</div>
<div class="w3-black">Black</div>
<div class="w3-white">White</div>
<div class="w3-grey">Grey</div>

Background Colors

<div class="w3-container w3-deep-orange">
    <p>Deep Orange Background</p>
</div>

<div class="w3-container w3-teal">
    <p>Teal Background</p>
</div>

<div class="w3-container w3-indigo">
    <p>Indigo Background</p>
</div>

Text Colors

<p class="w3-text-red">Red text</p>
<p class="w3-text-blue">Blue text</p>
<p class="w3-text-green">Green text</p>
<p class="w3-text-orange">Orange text</p>

Color Palette

ColorClassHex
Redw3-red#F44336
Pinkw3-pink#E91E63
Purplew3-purple#9C27B0
Deep Purplew3-deep-purple#673AB7
Indigow3-indigo#3F51B5
Bluew3-blue#2196F3
Light Bluew3-light-blue#03A9F4
Cyanw3-cyan#00BCD4
Tealw3-teal#009688
Greenw3-green#4CAF50
Light Greenw3-light-green#8BC34A
Limew3-lime#CDDC39
Yelloww3-yellow#FFEB3B
Amberw3-amber#FFC107
Orangew3-orange#FF9800
Deep Orangew3-deep-orange#FF5722
Brownw3-brown#795548
Greyw3-grey#9E9E9E
Blue Greyw3-blue-grey#607D8B

Hover Effects

<div class="w3-button w3-red w3-hover-orange">Red to Orange on Hover</div>
<div class="w3-button w3-blue w3-hover-green">Blue to Green on Hover</div>

Mini Practice

Create HTML code that:

  1. Uses different background colors
  2. Creates colored text
  3. Adds hover effects to buttons
  4. Creates a color palette display

Up Next

Next: Learn about W3.CSS Borders.

Related Topics

Frequently Asked Questions about Colors

What is Colors in W3.CSS?

Colors is a fundamental concept in W3.CSS. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Colors?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Colors.

Why is Colors important in W3.CSS?

Colors is essential for W3.CSS development. Understanding this concept will help you write better code and solve real-world problems more effectively.