GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

HTMLTableCellElement: bgColor property

HTML DOM

HTML DOM

The **`HTMLTableCellElement.bgColor`** property is used to set the background color of a cell or get the value of the obsolete [`bgColor`](/docs/Web/HTML/Reference/Elements/td#bgcolor) attribute, if present.

> [!NOTE]
> This property is deprecated and CSS should be used to set the background color. Use the background-color property instead.

## Value

One of the following value types can be used:

- a named color, like `red` or `blue`
- a hex code, like `#0000dd` or `#00d`

> [!NOTE]
> The values accepted here are a limited subset of the CSS color values. Only named-color and 3- or 6-digit hex-color (with no alpha-channel). While all HTML color values are valid in CSS, this is not true in the other direction.

## Examples

Use CSS `background-color` instead. An example of using [`background-color` with HTML table elements](/docs/Web/CSS/Reference/Properties/background-color#colorized_tables) is available on the background-color page.

## Specifications

## Browser compatibility

## See also

- HTMLTableRowElement.bgColor

source: MDN Web Docs mirror · page

Cite this

"HTMLTableCellElement: bgColor property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/bgColor

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·