Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the color value of css

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the css how to set the color value of the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe you will get something after reading this css how to set the color value of the article, let's take a look at it.

Syntax:

Rgb (rmae gpene b)

R: sets the red value, which can be set as a positive integer or percentage

G: set the green value, which can be set as a positive integer or percentage

B: sets the blue value, which can be set as a positive integer or percentage.

Description: each parameter (r, g, and b) in rgb () defines the intensity of different colors and can be a positive integer between 0 and 255, or a percentage value (from 0 to 100%).

Let's use a simple code example to see how rgb () sets the color.

Div {

Width:350px

Height:200px

Background-color:rgb (0d0j0pl 0)

Color:rgb (255255255)

Border:1pxsolidrgb (255, 010, 0)

Padding:10px

}

This is a piece of test code

Set the background color of the box to black [rgb (0memo 0jin0)]

Set the color of font text to white [rgb (255255255])

The border color is red [rgb (255pm 0pc0)]

Effect picture:

2.jpg

In the above example, we set the background color, font text color, and border color of the box by setting different rgb () color values for background-color,color,border.

We should pay attention to how to write the color value of rgb (). In the following code example, some of the values of the rgb () function are right and some are wrong. Pay attention to the distinction:

/ * use the value method of positive integer * /

Rgb (255j0pl 51)

Rgb (255jue 51.2) / * incorrectly written, cannot be a floating point number, it must be a positive integer * /

/ * use the value method of% * /

Rgb (100%, 0%, 20%)

Rgb (100% zero zero 20%) / * incorrect writing, cannot mix integer and percentage values * /

This is the end of the article on "how to set the color value of css". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to set the color value of css". If you want to learn more, you are welcome to follow the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report