Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript fontcolor() Method

JavaScript fontcolor() Method

String Object Reference JavaScript String object


Definition and Usage

The fontcolor() method is used to display a string in a specified color.

This method returns the string with an tag added, as shown below:

string

Syntax

string

.fontcolor(color)

Parameters Description
color Required. Specifies the font-color for the string. The value must be a color name (red), an RGB value (rgb(255,0,0)), or a hexadecimal number (#FF0000).

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the fontcolor() method.


Example

Example

Display the string in green:

Try it »


String Object Reference JavaScript String object