VOOZH about

URL: https://www.geeksforgeeks.org/html/html-table-bgcolor-attribute/

⇱ HTML <table> bgcolor Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML <table> bgcolor Attribute

Last Updated : 11 Jul, 2025


The bgcolor attribute in HTML <table> tag was previously used to set the background color of a table. It was once generally used in over 60% of legacy websitesto quickly style table elements without depending on CSS. Although modern best practices recommend using CSS for styling, understanding bgcolor remains important for maintaining or updating older web projects where inline attributes are still present.

Syntax

<table bgcolor="color_name | hex_number | rgb_number">


Attribute Values

  • color_name: It sets the text color by using the color name. For example, "red".
  • hex_number: It sets the text color by using the color hex code. For example, "#0000ff".
  • rgb_number: It sets the text color by using the RGB code. For example: "RGB(0, 153, 0)" .


Note: The <table> bgcolor Attribute is not supported by HTML 5. Instead of using this, we can use the CSS background-color property.

Example:

Output

👁 output


Browser Support

Attribute👁 Chrome
👁 Edge
👁 Firefox
👁 Safari
👁 Opera
<table> bgcolor
Desktopv1v12v1v1v15
Mobilev18v4v1v14
Comment
Article Tags: