In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what are the ways of CSS color representation?". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
You may wonder why we use six digits to represent a color instead of just one or two digits. The answer is to use six digits to provide us with a huge number of color changes.
How many possible colors will there be? To tell you, 16 values (0F) and 6 positions mean that we have 16 to the 6th power, or more than 16 million possible colors.
Hex code follows the red-green-blue (red-green-blue), or rgb format. The first two bits in the hex code represent the amount of red in the color, the third and fourth bits represent the amount of green, and the fifth and sixth digits represent the quantity of blue.
So to get absolute pure red, you only need to use F (the highest possible value) in the first and second places, and 0 (the least possible value) in the third, fourth, fifth and sixth places.
Here are some common colors:
By applying the hex code value to the background-color:
# FF0000 (# F00) can set the background color of the body element to red
# 00FF00 can set the background color of the body element to green
# 0000FF can set the background color of the body element to blue
# FFA500 can set the background color of the body element to orange
# 808080 you can set the background color of the body element to gray
# 111111 you can set the background color of the body element to dark gray.
Another way to represent colors in CSS is to use RGB values.
The RGB value for black looks like the following:
Rgb (0,0,0)
The white RGB value looks like the following:
Rgb (255,255,255)
With rgb, you specify the brightness of each color by a number between 0 and 255, instead of using six hexadecimal digits as hex code does.
If you do the math, 16 times 16 has a total of 256values, so rgb counted from scratch has exactly the same number of possible values as hex code.
Red RGB value: rgb (255,0,0)
Green RGB value: rgb (0,255,0)
Blue RGB value: rgb (0,0,255)
Orange RGB value: rgb (255,165,0)
This is the end of the content of "what are the ways of CSS color representation". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.