Get the App
SLTechnology News&Howtos  ›  Development  › 

Is color a new property of css3?

Shulou Source: shulou.com Published: 2022-05-31 20:08:17 10月04日 Update

Today, the editor would like to share with you the relevant knowledge points about color is a new attribute of css3. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look.

Color is not a new property of css3, and the color property has been used in css1; the color property is used to specify the color of the text, which can be set using the color name, hexadecimal character, RGB (red, green and blue), RGBA, HSL (hue, saturation, lightness), and the HSLA method.

The operating environment of this tutorial: windows10 system, CSS3&&HTML5 version, Dell G3 computer.

Is color a new attribute for css3?

Color is not a new property of css3

Color version: CSS1

The color attribute specifies the color of the text.

This property sets the foreground color of an element (in the HTML representation, the color of the element's text); the raster image is not affected by color. This color is also applied to all borders of the element unless overridden by border-color or some other border color attribute.

The easiest way to set the foreground color of an element is to use the color attribute.

Color values can be set in the following ways:

The name of the color, such as red, blue, brown, lightseagreen, etc., is not case-sensitive.

The hexadecimal symbols # RRGGBB and # RGB (for example, # ff0000). "#" is followed by 6 or 3 hexadecimal characters (0-9, Amurf).

RGB, red-green-blue (red-green-blue (RGB)) specifies that the color value is the color of the rgb code, and the function format is rgb (R _ Magi G _ (B)). The value can be an integer or a percentage of 0-255.

RGBA, Red-Green-Blue-Alpha (RGBa) RGBa extends the RGB color model, which includes alpha channels that allow you to set the transparency of a color. A means transparency: 0 = transparent; 1 = opaque.

HSL, hue-saturation-luminance (Hue-saturation-lightness) hue (Hue) represents the angle of the color ring (that is, a ring that represents a rainbow).

Saturation and lightness are expressed as percentages.

100% is full saturation, while 0% is a grayscale.

100% lightness is white, 0% lightness is black, and 50% lightness is "average".

HSLA, Hue-saturation-Luminance-HSLa (HSLa) HSLa extends from the HSL color model and includes alpha channels that specify the transparency of a color. A means transparency: 0 = transparent; 1 = opaque.

Examples are as follows:

Body {color: # 92a8d1;} body {color: rgb;} body {color: rgba);} body {color: hsl (120100%);} body {color: hsla (240100% 50,0.7);}

The output is as follows:

These are all the contents of the article "is color a new attribute of css3?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Color attribute lightness saturation saturation element hexadecimal knowledge article hue transparency Alpha name text content character that is method scenery Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple vpn Microsoft NVidia Shulou Tech Info