HTML <col> bgcolor Attribute Last Updated : 17 May, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The HTML <col> element bgcolor attribute was used in HTML to set background colors for table columns. It is deprecated in HTML 4.01 and not supported in HTML5. Instead, CSS should be used to style table columns with the background-color property. Syntax: <col bgcolor= "color_name | hex_number | rgb_number">Attribute Values: Attribute name Description Example color_name Sets the text color by using the color name. "red" hex_number Sets the text color by using the color hex code. "#0000ff" rgb_number Sets the text color by using the RGB code. "RGB(0, 153, 0)" Example: In this example we showcases a table with three columns, where the first two share a green background, and the third has a blue background. It lists names, branches, and expenses for each entry. html <!DOCTYPE html> <html> <head> <title> HTML col bgcolor Attribute </title> </head> <body> <h2>HTML col bgcolor Attribute</h2> <table border="1"> <colgroup> <col span="2" bgcolor="green"> <col bgcolor="blue"> </colgroup> <tr> <th>Name</th> <th>Branch</th> <th>Expenses</th> </tr> <tr> <td>BITTU</td> <td>CSE</td> <td>2500.00</td> </tr> <tr> <td>RAKESH</td> <td>ECE</td> <td>1400.00</td> </tr> </table> </body> </html> Output: HTML col bgcolor Attribute Example Output Example: In this example we defines a table with three columns, each with a different background color. The table contains two rows of data. HTML <!DOCTYPE html> <html> <head> <title>Table Column Background Color</title> </head> <body> <table border="1"> <colgroup> <col bgcolor="lightblue"> <col bgcolor="lightgreen"> <col bgcolor="lightyellow"> </colgroup> <tr> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> </tr> <tr> <td>Row 1, Cell 1</td> <td>Row 1, Cell 2</td> <td>Row 1, Cell 3</td> </tr> <tr> <td>Row 2, Cell 1</td> <td>Row 2, Cell 2</td> <td>Row 2, Cell 3</td> </tr> </table> </body> </html> Output: HTML col bgcolor Attribute Example Output Supported Browsers: Google ChromeEdge FirefoxOperaSafari Comment More infoAdvertise with us Next Article HTML | bgcolor Attribute M manaschhabra2 Follow Improve Article Tags : Web Technologies HTML HTML-Attributes Similar Reads HTML | <colgroup> bgcolor Attribute The HTML <colgroup> bgcolor attribute is used to specify the background color of a colgroup element. It is not supported by HTML 5. Syntax: <colgroup bgcolor= "color_name | hex_number | rgb_number"> Attribute Values: color_name: It sets the text color by using the color name. For example 1 min read HTML <body> bgcolor Attribute The bgcolor attribute in HTML was traditionally used to set background colors for elements such as <body>, <table>, <td>, and <tr>. It supports named colors, hex codes, and RGB values. However, since it's deprecated in HTML5, over 90% of modern developers now prefer using CSS 2 min read HTML <td> bgcolor Attribute The HTML <td> bgcolor attribute is used to specify the background color of a table cell. It basically, Specify the background color with a hexadecimal code for precise coloring and offers limited color choices compared to modern CSS styling. Note: It is not supported by HTML5. Syntax:<td b 2 min read HTML <tr> bgcolor Attribute The HTML <tr> bgcolor Attribute is used to specify the background color of a table row. This attribute accepts color values such as color names, hex codes, or RGB values, allowing for easy customization of the background color for individual rows in an HTML table.Note: It is not supported by H 2 min read HTML <th> bgcolor Attribute The bgcolor attribute in the HTML <th> (table header) tag is used to set the background color of a table header cell. You can specify colors using color names, hexadecimal codes, or RGB values. Note: It is not supported by HTML5. Syntax:<th bgcolor="color_name | hex_number | rgb_number"> 2 min read HTML | <col> char Attribute The HTML <col> char attribute is used to set the alignment of the content in a column in a character. It can only be used if the align attribute is set to "character". The default value of char is the decimal-point character of the page language. Syntax: <col char="character"> Attribute 1 min read Like