這是一段普通的段落。請(qǐng)注意,該段落的文本是紅色的。在 body 選擇器中定義了本頁(yè)面中的默認(rèn)文本顏色。<\/p>\n\t\t
該段落定義了 class=\"ex\"。該段落中的文本是藍(lán)色的。<\/p>\n\t<\/body>\n\n<\/html><\/pre>
Rendering:
<\/p>
<\/p>
Description: The <\/strong><\/p> color attribute can be used to set the text Color; this property sets the foreground color of an element (in HTML representation, the color of the element's text). <\/p> Grammar: How to write css color values: <\/span><\/p> 1. Use color names<\/p> <\/li><\/ul> Although there are currently about 184 named colors, there are only 16 color names that are truly supported by various browsers and recommended as CSS specifications, as shown in the table below. <\/p> Table 1: Color names recommended by CSS specifications<\/p> It is not recommended to use color names in web pages, especially large-scale use, to avoid that some color names are not parsed by the browser, or are different Differences in how browsers interpret colors. <\/p> 2. Hexadecimal color <\/p><\/li><\/ul> Hexadecimal symbols #RRGGBB and #RGB (such as #ff0000). \"#\" followed by 6 or 3 hexadecimal characters (0-9, A-F). <\/p> This is the most commonly used color selection method, for example: <\/p> 3, RGB, red-green-blue (RGB)<\/p><\/li><\/ul> Specifies that the color value is the color of rgb code, the function format is rgb(R,G,B), and the value can be an integer or percentage from 0-255. <\/p> Extensions: RGBA, Red-Green-Blue-Alpha (RGBa)<\/p> RGBA extends the RGB color mode to include an alpha channel, allowing the transparency of a color to be set. a represents transparency: 0=transparent; 1=opaque. <\/p> 4. HSL, hue-saturation-lightness (Hue-saturation-lightness) <\/p><\/li><\/ul> Hue (Hue) represents the color wheel ( That is, an angle representing a circle of a rainbow). Extension: HSLA, Hue-Saturation-Lightness-Alpha (HSLa)<\/p> HSLa extends from the HSL color mode and includes the alpha channel, which can specify the transparency of a color. a represents transparency: 0=transparent; 1=opaque. <\/p> 5. transparent<\/p><\/li><\/ul> Special color value, indicating transparent color. Can be used directly as color. <\/p> For example: color:transparent Set the font color to transparent <\/p>
<\/p>color : 顏色值;<\/pre>
\/*名 稱\t顏 色\t名 稱\t顏 色\t名 稱\t顏 色\nblack\t純黑\tsilver\t淺灰\tnavy\t深藍(lán)\nblue\t淺藍(lán)\tgreen\t深綠\tlime\t淺綠\nteal\t靛青\taqua\t天藍(lán)\tmaroon\t深紅\nred\t大紅\tpurple\t深紫\tfuchsia\t品紅\nolive\t褐黃\tyellow\t明黃\tgray\t深灰\nwhite\t殼白*\/<\/pre>
#f03\n#F03\n#ff0033\n#FF0033<\/pre>
rgb(255,0,51)\nrgb(255, 0, 51)\nrgb(100%,0%,20%)\nrgb(100%, 0%, 20%)<\/pre>
rgba(255,0,0,0.1) \/* 10% 不透明 *\/ \nrgba(255,0,0,0.4) \/* 40% 不透明 *\/ \nrgba(255,0,0,0.7) \/* 70% 不透明 *\/ \nrgba(255,0,0, 1) \/* 不透明,即紅色 *\/<\/pre>
Saturation and brightness 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 \"normal\". <\/p>hsl(120,100%,25%) \/* 深綠色 *\/ \nhsl(120,100%,50%) \/* 綠色 *\/ \nhsl(120,100%,75%) \/* 淺綠色 *\/<\/pre>
hsla(240,100%,50%,0.05) \/* 5% 不透明 *\/ \nhsla(240,100%,50%, 0.4) \/* 40% 不透明 *\/ \nhsla(240,100%,50%, 0.7) \/* 70% 不透明 *\/ \nhsla(240,100%,50%, 1) \/* 完全不透明 *\/<\/pre>