HTMLTableRowElement: bgColor property

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The HTMLTableRowElement.bgColor property is used to set the background color of a row or retrieve the value of the obsolete 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.


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.


Use CSS background-color instead. An example is available on the background-color page.


HTML Standard
# dom-tr-bgcolor

Browser compatibility

BCD tables only load in the browser

See also