Premium Only Content
CSS Color Values with Hex Code and RGB
The lecture introduces you to another way of specifying a color in CSS.
Previously you learned that you can specify the color name, like red, green, or blue. But there are other ways of defining a color value, like using the hex value or the rgb value.
The hexadecimal value (aka hex) is a value that ranges from 0 to 255 in base 10, but is written in base 16 ranging from 0 to ff. That's why it's called hexadecimal, because one digit can have 16 different characters. It goes from the usual 0 to 9, then after that is goes using the letters a through f.
For the specific case of color hex codes, there are usually six digits. The first two digits are the value for the Red. The middle two digits are the values for the Green. The last two digits are the value for the Blue. Hence the abbreviation RGB whenever you need to compose those three colors to build any one color. For CSS, the hex value is always prefixed with a hash or pound sign.
You can also specify color values using base-10 RGB by saying rgb followed by parentheses. Inside the parentheses you write the values for RGB, separated by a comma. For example, for the Red value, instead of writing ff in hexadecimal, you would write 255 in decimal.
To show the red color, simply use value 255 for Red, 0 for Green, and 0 for Blue.
To show the green color, simply use value 0 for Red, 255 for Green, and 0 for Blue.
To show the blue color, simply use value 0 for Red, 0 for Green, and 255 for Blue.
-
1:37:36
Whiskey and Windage Podcast
4 hours ago $0.51 earnedInside Q: BoomBox, Mega Fix, Black Titanium & the Mindset Behind the Brand
21.9K -
LIVE
SternAmerican
1 day agoELECTION INTEGRITY CALL HOSTED BY STEVE STERN - WED, FEBRUARY 4 @ 2PM EST
253 watching -
17:49
The White House
3 hours agoFirst Lady Melania Trump Meets with Freed American-Israeli Hostage Keith Siegel
22.6K12 -
1:34:49
Sean Unpaved
4 hours agoKirk Herbstreit Joins The Show! | UNPAVED
34.9K -
1:00:36
Timcast
3 hours agoTHEY HAVE CAVED
199K81 -
1:12:54
BonginoReport
4 hours agoMinneapolis Mayor Needs a Reality Check! - Scrolling w/ Hayley Caronia (Ep.228)
96.8K67 -
2:04
Simply Bitcoin
22 hours ago $0.74 earnedRumble Wallet Walk Through
30.5K7 -
2:59:44
Wendy Bell Radio
7 hours agoTerm Limits Fix All This
71.8K83 -
1:07:03
Framers View
4 hours agoFramersView
23.5K3 -
LIVE
LFA TV
18 hours agoLIVE & BREAKING NEWS! | WEDNESDAY 2/4/26
1,587 watching