HTML | Bgcolor Attribute - GeeksforGeeks

Skip to content geeksforgeeks
  • Courses
    • DSA Courses
    • Programming Languages
  • Tutorials
    • Python Tutorial
      • Python Loops and Control Flow
    • Java
      • Java Interview Questions
      • Java Quiz
      • Advance Java
    • Programming Languages
    • System Design
    • Interview Corner
    • Computer Science Subjects
    • DevOps
    • Linux
    • Software Testing
    • Databases
    • Android
    • Excel
    • Mathematics
  • DSA
    • Data Structures
    • Algorithms
      • Analysis of Algorithms
      • Searching Algorithms
      • Sorting Algorithms
    • Practice
      • Company Wise Coding Practice
      • Practice Problems Difficulty Wise
      • Language Wise Coding Practice
      • Curated DSA Lists
    • Company Wise SDE Sheets
    • DSA Cheat Sheets
    • Puzzles
  • Data Science
    • Data Science Packages
    • Data Visualization
    • Data Analysis
  • Web Tech
    • Web Development Using Python
      • Django
      • Flask
    • Cheat Sheets
  • HTML Tutorial
  • HTML Exercises
  • HTML Tags
  • HTML Attributes
  • Global Attributes
  • Event Attributes
  • HTML Interview Questions
  • HTML DOM
  • DOM Audio/Video
  • HTML 5
  • HTML Examples
  • Color Picker
  • A to Z Guide
  • HTML Formatter
Open In App HTML | <colgroup> bgcolor Attribute Last Updated : 30 Dec, 2019 Summarize Comments Improve Suggest changes Like Article Like Save Share Report Follow

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 “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)”.

Example:

<!DOCTYPE html> <html> <head> <title> HTML colgroup bgcolor Attribute </title> <style> table { color: white; margin-left: 180px; } td { padding: 10px; } </style> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <h2> HTML ColumnGroup bgcolor Attribute </h2> <table> <colgroup id="myColGroup" span="2" bgcolor="green"> </colgroup> <tr> <th>S.No</th> <th>Title</th> <th>Geek_id</th> </tr> <tr> <td>Geek_1</td> <td>GeekForGeeks</td> <th>Geek_id_1</th> </tr> <tr> <td>Geek_2</td> <td>GeeksForGeeks</td> <th>Geek_id_2</th> </tr> </table> </body> </html>

Output:

Supported Browsers: The browser supported by HTML <colgroup> bgcolor attribute are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera
Comment More info Next Article HTML <col> bgcolor Attribute

M

ManasChhabra2 Follow Improve

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 <col> bgcolor Attribute 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_numb 2 min read
  • HTML <colgroup> char Attribute The HTML <colgroup> char Attribute is used to set the alignment of the content in a column group in a character. It can only be used if the align attribute is set to "character". The default worth of char is that the decimal-point character of the page language.Syntax: <colgroup char="chara 1 min read
  • HTML <body> bgcolor Attribute The HTML bgcolor attribute sets background colors for elements like <body>, <table>, <td>, and <tr>. While it accepts color names, hex, or RGB values, it is deprecated in HTML5. CSS's background-color property is now preferred for styling backgrounds. Note: It is not supporte 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 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 <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 | <colgroup> span Attribute The HTML <colgroup> span Attribute is used to define the number of column that a <colgroup> element should span. Syntax: <colgroup span="number"> Attribute Values: number: It contains the numeric value which specifies the number of col element should span. Example: C/C++ Code & 1 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
  • HTML | <colgroup> align Attribute The HTML <colgroup> align attribute is used to set the horizontal alignment of the text or content in the group of column. Syntax: <colgroup align="left|right|center|justify|char> Attribute Values: left: It sets the content to the left-align.right: It sets the content to the right-align. 1 min read
  • HTML <colgroup> width Attribute The HTML <colgroup> width Attribute is used to specify the width of the colgroup element. The <colgroup> attribute sets a predefined width of the column group. Syntax<colgroup width="pixels|%|relative_lngth">Attribute ValuesValue Description pixels It specify the width of the colgr 1 min read
  • HTML | <table> bgcolor Attribute The HTML <table> bgcolor Attribute is use to specify the background color of a table.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 1 min read
  • HTML | <tbody> bgcolor Attribute The HTML tbody bgcolor Attribute is used to specify the background color of a table body(tbody). It is not supported by HTML 5. Syntax: <tbody 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_n 1 min read
  • HTML | <tfoot> bgcolor Attribute The HTML <tfoot> bgcolor Attribute is used to specify the background color of a foot of the table. It is not supported by HTML 5. Syntax: <tfoot bgcolor= "color_name | hex_number | rgb_number"> Attribute Values: color_name: It sets the text color by using the color name. For example "red 1 min read
  • HTML <hr> color Attribute The HTML <hr> color attribute was used to specify the color of horizontal lines, adding visual separation in content. Although deprecated in HTML5, similar effects can be achieved using CSS by styling the <hr> element with border or background properties. Note: It is not supported by HTM 3 min read
  • HTML | <colgroup> valign Attribute The HTML <colgroup> valign Attribute is used to specify the vertical alignment of text content in a colgroup Element. Syntax: <colgroup valign="top | middle | bottom | baseline"> Attribute Values top: It sets the content to top-align. middle: It sets the content to middle-align. bottom: 1 min read
  • HTML | <basefont> color Attribute The HTML <basefont> color Attribute is used to set the default font color in a document. Note: This attribute is not supported by HTML5. Syntax: <basefont color="color_name|hex_number|rgb_number"> Attribute Values: color_name It is used to specify the name of the font color. hex_number: 1 min read
  • HTML | <col> charoff Attribute The HTML <col> charoff attribute is used to set the number of characters that aligned the characters specified by the char attribute. This attribute can only be used in the char attribute and align attribute is specified in the <col> element. Syntax: <col charoff="number"> Attribut 1 min read
  • HTML bgcolor Attribute HTML bgcolor attribute is used to set the background color of an HTML element. Bgcolor is one of those attributes that has become deprecated with the implementation of Cascading Style Sheets (see CSS Backgrounds). It accepts color names, hexadecimal color codes, or RGB values to customize the backgr 3 min read
Article Tags :
  • HTML
  • Web Technologies
  • HTML-Attributes
Like three90RightbarBannerImg Explore More We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy Got It ! Lightbox Improvement Suggest changes Suggest Changes Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal. geeksforgeeks-suggest-icon Create Improvement Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all. geeksforgeeks-improvement-icon Suggest Changes min 4 words, max CharLimit:2000

What kind of Experience do you want to share?

Interview Experiences Admission Experiences Career Journeys Work Experiences Campus Experiences Competitive Exam Experiences

Từ khóa » Html Colgroup Background Color