HTML | <colgroup> bgcolor Attribute
Last Updated :
30 Dec, 2019
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
Share your thoughts in the comments
Please Login to comment...