web api instance property
HTMLTableElement: bgColor property
The bgcolor property of the HTMLTableElement represents the
background color of the table.
[!NOTE] Do not use this attribute anymore. Instead, use the CSS
background-colorproperty by modifying the element’sstyleattribute or using a style rule.
Value
A string representing a color value.
When set to the null value, that null value is converted to the empty string (""), so elt.bgColor = null is equivalent to elt.bgColor = "".
Examples
// Set table background color to lightblue
const t = document.getElementById("TableA");
t.bgColor = "lightblue";
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.