Partager via


color property

The foreground color of the text of an object.

 

Syntax

Integer value = object.put_color(Variant v);Integer value = object.get_color(Variant* sColor);

Property values

Type: VARIANT

One of the color names or RGB values in the Color Table.

String format

<color>

CSS information

Applies To All elements
Media visual
Inherited true
Initial Value black

Standards information

Remarks

Some browsers do not recognize color names, but all browsers should recognize RGB color values and display them correctly.

An RGB color value normally consists of a "#" immediately followed by a triad of two-digit hexadecimal numbers specifying the intensity of the corresponding color: (R)ed, (G)reen, and (B)lue. For example, the color value "#FF0000" is rendered red because the red number is set to its highest value, "FF" (or "255", in decimal).

Each of the following style rules refer to the same color—namely, red. The three digit short-hand form is converted into the six digit form by replicating digits ("#F00" becomes "#FF0000"). The functional rgb() notation uses a comma-separated list of integer numbers from 0 to 255, or percentage values.

em { color: red }              /* natural language / CNS */
em { color: #F00 }             /* #RGB */
em { color: #FF0000 }          /* #RRGGBB */
em { color: rgb(1.0,0.0,0.0) } /* float range: 0.0 - 1.0 */
em { color: rgb(100%,0%,0%) ]  /* float range: 0.0 - 100.0 */

Windows Internet Explorer 9 introduced support for the RGBA, HSL, and HSLA color models.

Windows apps using JavaScript support the RGB, RGBA, HSL, and HSLA color models.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

Color Table