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:17:59
Awaken With JP
6 hours agoGovernment: We’re NOT Here to Help - LIES Ep 60
62.4K44 -
1:01:08
In The Litter Box w/ Jewels & Catturd
20 hours agoDemocrat Priorities = America Last | In the Litter Box w/ Jewels & Catturd – Ep. 663 – 10/8/2024
46K41 -
1:06:02
TheMonicaCrowleyPodcast
3 hours agoThe Monica Crowley Podcast: A Conversation with JD Vance - Plus Kamala Calls Her Daddy
17.5K4 -
2:12:17
Revenge of the Cis
4 hours agoEpisode 1388: Bear Necessities
18.7K2 -
1:08:05
Officially Unfollowed
2 hours agoKamala on Call Her Daddy, RNC Sues Fulton County, & FEMA Prioritizes LGBTQ People | Ep. 11
18.7K12 -
2:38:03
Steven Crowder
6 hours agoLIVE: Kamala Harris v. Howard Stern | Interview Watch Party
377K1.05K -
1:05:08
Ben Shapiro
5 hours agoEp. 2062 - Donald Trump Joins The Show!
88.5K86 -
1:58:07
The Quartering
5 hours agoKamala Harris DESTROYS Chances On 60 Minutes, FEMA Bombshell, Tomb Raider Gets Woke & More
64.4K20 -
1:28:57
The New American
4 hours agoThe New American Daily | Another Mega-hurricane Bears Down on Florida
32.1K4 -
1:07:10
Russell Brand
7 hours agoHillary Clinton DEMANDS Free Speech CENSORSHIP CRACKDOWN – Rumble, X TARGETED! - SF469
142K617