VOOZH about

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

⇱ HTML <th> bgcolor Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML <th> bgcolor Attribute

Last Updated : 22 May, 2026

The bgcolor attribute in the <th> tag is used to set the background color of a header cell. It was commonly used in older HTML but is now deprecated in HTML5.

  • Sets the background color of a header cell.
  • Accepts color names, hex codes, or RGB values.
  • Used only with the <th> element.

Note: It is not supported by HTML5.

Syntax

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

Attribute Values

  • color_name: Sets background color using a color name (e.g., "red")
  • hex_number: Sets background color using a hex code (e.g., "#0000ff")
  • rgb_number: Sets background color using RGB values (e.g., "rgb(0, 153, 0)")

Example 1: Using Color name

Example 2: Using rgb number

Comment
Article Tags: