HTMLTableRowElement: bgColor property
HTML DOM
HTML DOM
The **`HTMLTableRowElement.bgColor`** property is used to set the background color of a row or retrieve the value of the obsolete [`bgColor`](/docs/Web/HTML/Reference/Elements/tr#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`
> [!NOTE]
> The values accepted here are a subset of the CSS color values. You can reuse HTML color values in CSS, but not in the other direction: the unknown colors would appear differently than expected.
## Examples
Use CSS `background-color` instead. An [example](/docs/Web/CSS/Reference/Properties/background-color#colorized_tables) is available on the background-color page.
## Specifications
## Browser compatibility
## See also
- HTMLTableCellElement.bgColor
Cite this
"HTMLTableRowElement: bgColor property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement/bgColor JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy