Table Backgrounds

You can set the table background using one of the following two ways.

  • bgcolor attribute –By Using this attribute to set background color for the whole table or just for one cell.
  • background attribute – By Using this attribute to set a background image for the whole table or just for one cell.
Example of Table Background color
<!DOCTYPE>
<html>
<body>
<table border="1" bgcolor="yellow">
<tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
<tr><td>Ram</td><td>singh</td><td>60</td></tr>
<tr><td>sonu</td><td>singh</td><td>80</td></tr>
<tr><td>Rakesh</td><td>Rajpoot</td><td>82</td></tr>
<tr><td>Amit</td><td>singh</td><td>72</td></tr>
</table>
</body>
</html>

Output

 
First_Name Last_Name Marks
Ram singh 60
sonu singh 80
Rakesh Rajpoot 82
Amit singh 72
First Program in HTML
<!DOCTYPE>
<html>
<body>
<table border="1" backgroud="https://nielitbhu.com/wp-content/uploads/2022/01/26-jan.jpg">
<tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
<tr><td>Ram</td><td>singh</td><td>60</td></tr>
<tr><td>sonu</td><td>singh</td><td>80</td></tr>
<tr><td>Rakesh</td><td>Rajpoot</td><td>82</td></tr>
<tr><td>Amit</td><td>singh</td><td>72</td></tr>
</table>
</body>
</html>

Output

First_NameLast_NameMarks
Ramsingh60
sonusingh80
RakeshRajpoot82
Amitsingh72

Table Caption

  • The caption tag will use as a title orthe explanation for the table .
  • The table caption is shows up at the top of the table.
Example of Table Caption
<!DOCTYPE>
<html>
<body>
<table border="1">
<caption>Student Records<caption>
<tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
<tr><td>Ram</td><td>singh</td><td>60</td></tr>
<tr><td>sonu</td><td>singh</td><td>80</td></tr>
<tr><td>Rakesh</td><td>Rajpoot</td><td>82</td></tr>
<tr><td>Amit</td><td>singh</td><td>72</td></tr>
</table>
</body>
</html>

Output

Student Records
First_Name Last_Name Marks
Ram singh 60
sonu singh 80
Rakesh Rajpoot 82
Amit singh 72
What is HTML
  • HTML is the standard  for Hypertext Markup Language for Web pages.
  • The HTML elements tell the browser ...
    Click Here
Previous topic next topic What is an Element in HTML
  • An Hypertext Markup Language(HTML) element ...
    Click Here
Previous topic next topic HTML Headings
  • The HTML headings are used to define the heading ...
    Click Here
Previous topic next topic HTML Formatting Elements
  • The <b>  element is use for bold text, without ...
    Click Here
Previous topic next topic HTML Comments
  • The HTML Comment are describe the extra feature about ...
    Click Here
Previous topic next topic HTML Attributes
  • Every HTML element can have attributes.
  • The HTML Attribute ...
    Click Here
Previous topic next topic HTML Images
  • The <img> tag is empty
Note: The empty ...
Click Here
Previous topic next topic HTML Links
  • HTML links are hyperlinks.
  • HTML link default color is ...
    Click Here
Previous topic next topic HTML Table
  • An HTML table is defined with the <table> tag.
  • ...
    Click Here
Previous topic next topic Table Backgrounds You can set the table background using one of the ...
Click Here
Previous topic next topic Table Header, tbody and Footer
  • Tables are categories into three parts: ...
    Click Here
Previous topic next topic Basic to Advance table design in HTML Example 1 <!DOCTYPE> <html> <body> ...
Click Here
Previous topic next topic HTML div tag
  • The <div>  element is used for style blocks ...
    Click Here
Previous topic next topic HTML Lists
  • The list is the way to present the data ...
    Click Here
Previous topic next topic HTML Form
  • The HTML <form> element is used to collect user ...
    Click Here
Previous topic next topic HTML Iframe Tag
  • <iframe> an inline frame with an HTML tag ...
    Click Here
English Hindi