W3Schools.com (2024)

An RGB color value represents RED, GREEN, and BLUE light sources.

An RGBA color value is an extension of RGB with an Alpha channel (opacity).

RGB Color Values

In HTML, a color can be specified as an RGB value, using this formula:

rgb(red, green, blue)

Each parameter (red, green, and blue) defines the intensity of the color with a value between 0 and 255.

This means that there are 256 x 256 x 256 = 16777216 possible colors!

For example, rgb(255, 0, 0) is displayed as red, because red is set to its highest value (255), and the other two (green and blue) are set to 0.

Another example, rgb(0, 255, 0) is displayed as green, because green is set to its highest value (255), and the other two (red and blue) are set to 0.

To display black, set all color parameters to 0, like this: rgb(0, 0, 0).

To display white, set all color parameters to 255, like this: rgb(255, 255, 255).

Experiment by mixing the RGB values below:

RED

255

GREEN

BLUE

Shades of Gray

Shades of gray are often defined using equal values for all three parameters:

Example

rgb(60, 60, 60)

rgb(100, 100, 100)

rgb(140, 140, 140)

rgb(180, 180, 180)

rgb(200, 200, 200)

rgb(240, 240, 240)


Try it Yourself »

RGBA Color Values

RGBA color values are an extension of RGB color values with an Alpha channel - which specifies the opacity for a color.

An RGBA color value is specified with:

rgba(red, green, blue, alpha)

The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (not transparent at all):

Experiment by mixing the RGBA values below:

RED

255

GREEN

BLUE

Example

rgba(255, 99, 71, 0)

rgba(255, 99, 71, 0.2)

rgba(255, 99, 71, 0.4)

rgba(255, 99, 71, 0.6)

rgba(255, 99, 71, 0.8)

rgba(255, 99, 71, 1)


Try it Yourself »

HTML Exercises


W3schools Pathfinder

Track your progress - it's free!

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved.W3Schools is Powered by W3.CSS.

W3Schools.com (2024)
Top Articles
How can you encrypt your mobile app to resist ransomware and spyware attacks?
Mutual Fund Distribution - A good career choice in India or not?
Mickey Moniak Walk Up Song
Drury Inn & Suites Bowling Green
Camera instructions (NEW)
Lorton Transfer Station
13 Easy Ways to Get Level 99 in Every Skill on RuneScape (F2P)
Wausau Marketplace
Www Craigslist Louisville
Kris Carolla Obituary
Optum Medicare Support
Monticello Culver's Flavor Of The Day
Encore Atlanta Cheer Competition
ATV Blue Book - Values & Used Prices
Citymd West 146Th Urgent Care - Nyc Photos
10 Best Places to Go and Things to Know for a Trip to the Hickory M...
Eka Vore Portal
2016 Ford Fusion Belt Diagram
Dr. med. Uta Krieg-Oehme - Lesen Sie Erfahrungsberichte und vereinbaren Sie einen Termin
Hollywood Bowl Section H
Richland Ecampus
Drift Boss 911
Morse Road Bmv Hours
Best Sports Bars In Schaumburg Il
55Th And Kedzie Elite Staffing
Weather October 15
Will there be a The Tower season 4? Latest news and speculation
Skepticalpickle Leak
Meowiarty Puzzle
Possum Exam Fallout 76
UPC Code Lookup: Free UPC Code Lookup With Major Retailers
Gwen Stacy Rule 4
What Time Does Walmart Auto Center Open
Tenant Vs. Occupant: Is There Really A Difference Between Them?
Andhra Jyothi Telugu News Paper
Msnl Seeds
Wisconsin Women's Volleyball Team Leaked Pictures
Ise-Vm-K9 Eol
Lovely Nails Prices (2024) – Salon Rates
Scarlet Maiden F95Zone
Casamba Mobile Login
Busted Newspaper Mcpherson Kansas
Craigslist Antique
Comanche Or Crow Crossword Clue
✨ Flysheet for Alpha Wall Tent, Guy Ropes, D-Ring, Metal Runner & Stakes Included for Hunting, Family Camping & Outdoor Activities (12'x14', PE) — 🛍️ The Retail Market
Hawkview Retreat Pa Cost
Gary Vandenheuvel Net Worth
Kate Spade Outlet Altoona
Minterns German Shepherds
Horseneck Beach State Reservation Water Temperature
Phunextra
Latest Posts
Article information

Author: Terrell Hackett

Last Updated:

Views: 6163

Rating: 4.1 / 5 (52 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Terrell Hackett

Birthday: 1992-03-17

Address: Suite 453 459 Gibson Squares, East Adriane, AK 71925-5692

Phone: +21811810803470

Job: Chief Representative

Hobby: Board games, Rock climbing, Ghost hunting, Origami, Kabaddi, Mushroom hunting, Gaming

Introduction: My name is Terrell Hackett, I am a gleaming, brainy, courageous, helpful, healthy, cooperative, graceful person who loves writing and wants to share my knowledge and understanding with you.