Color - Web APIs - MDN Web Docs

  1. References
  2. Web APIs
  3. HTMLTableElement
  4. bgColor
Article Actions
  • English (US)
    • Remember language
    • Deutsch
    • 日本語
  • Value
  • Examples
  • Specifications
  • Browser compatibility
  • See also
  1. HTML DOM API
  2. HTMLTableElement
  3. Instance properties
    1. align Deprecated
    2. bgColor Deprecated
    3. border Deprecated
    4. caption
    5. cellPadding Deprecated
    6. cellSpacing Deprecated
    7. frame Deprecated
    8. rows
    9. rules Deprecated
    10. summary Deprecated
    11. tBodies
    12. tFoot
    13. tHead
    14. width Deprecated
  4. Instance methods
    1. createCaption()
    2. createTBody()
    3. createTFoot()
    4. createTHead()
    5. deleteCaption()
    6. deleteRow()
    7. deleteTFoot()
    8. deleteTHead()
    9. insertRow()
  5. Inheritance
    1. HTMLElement
    2. Element
    3. Node
    4. EventTarget
  6. Related pages for HTML DOM
    1. BeforeUnloadEvent
    2. DOMStringMap
    3. ErrorEvent
    4. HTMLAnchorElement
    5. HTMLAreaElement
    6. HTMLAudioElement
    7. HTMLBRElement
    8. HTMLBaseElement
    9. HTMLBodyElement
    10. HTMLButtonElement
    11. HTMLCanvasElement
    12. HTMLDListElement
    13. HTMLDataElement
    14. HTMLDataListElement
    15. HTMLDialogElement
    16. HTMLDivElement
    17. HTMLDocument
    18. HTMLElement
    19. HTMLEmbedElement
    20. HTMLFieldSetElement
    21. HTMLFormControlsCollection
    22. HTMLFormElement
    23. HTMLFrameSetElement Deprecated
    24. HTMLHRElement
    25. HTMLHeadElement
    26. HTMLHeadingElement
    27. HTMLHtmlElement
    28. HTMLIFrameElement
    29. HTMLImageElement
    30. HTMLInputElement
    31. HTMLLIElement
    32. HTMLLabelElement
    33. HTMLLegendElement
    34. HTMLLinkElement
    35. HTMLMapElement
    36. HTMLMediaElement
    37. HTMLMenuElement
    38. HTMLMetaElement
    39. HTMLMeterElement
    40. HTMLModElement
    41. HTMLOListElement
    42. HTMLObjectElement
    43. HTMLOptGroupElement
    44. HTMLOptionElement
    45. HTMLOptionsCollection
    46. HTMLOutputElement
    47. HTMLParagraphElement
    48. HTMLPictureElement
    49. HTMLPreElement
    50. HTMLProgressElement
    51. HTMLQuoteElement
    52. HTMLScriptElement
    53. HTMLSelectElement
    54. HTMLSourceElement
    55. HTMLSpanElement
    56. HTMLStyleElement
    57. HTMLTableCaptionElement
    58. HTMLTableCellElement
    59. HTMLTableColElement
    60. HTMLTableRowElement
    61. HTMLTableSectionElement
    62. HTMLTemplateElement
    63. HTMLTextAreaElement
    64. HTMLTimeElement
    65. HTMLTitleElement
    66. HTMLTrackElement
    67. HTMLUListElement
    68. HTMLUnknownElement
    69. HTMLVideoElement
    70. HashChangeEvent
    71. History
    72. ImageData
    73. Location
    74. MessageChannel
    75. MessageEvent
    76. MessagePort
    77. Navigator
    78. PageRevealEvent
    79. PageSwapEvent
    80. PageTransitionEvent
    81. Plugin Deprecated
    82. PluginArray Deprecated
    83. PromiseRejectionEvent
    84. RadioNodeList
    85. UserActivation
    86. ValidityState
    87. Window
    88. WorkletGlobalScope
  • Value
  • Examples
  • Specifications
  • Browser compatibility
  • See also

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 bgcolor property of the HTMLTableElement represents the background color of the table.

Note: Do not use this attribute anymore. Instead, use the CSS background-color property by modifying the element's style attribute 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

js// Set table background color to lightblue const t = document.getElementById("TableA"); t.bgColor = "lightblue";

Specifications

Specification
HTML Standard # dom-table-bgcolor

Browser compatibility

BCD tables only load in the browser

See also

  • background-color

Help improve MDN

Was this page helpful to you?YesNoLearn how to contribute.

This page was last modified on Jul 26, 2024 by MDN contributors.

View this page on GitHub • Report a problem with this content

Từ khóa » Html Bgcolor Tag