<table background=""><tr background=""><td background="">

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O
Type
  • Extension

The background attribute of the TABLE, TR, and TD (TH) elements specifies the background image of the table.


<table background="back.gif"></table> : Applied to an entire table

<tr background="back.gif"></tr> : Applied to all cells in a row

<td background="back.gif"></td> : Applied to one cell

Attribute Value Explanation
background=" " URL the URL of the image to display

Extension attribute. (Non standard attribute)

Example

Background image Background image

Background image of the table

<table border="1" background="image/back.gif">
<tr>
<td>Row1 - Col1</td>
<td>Row1 - Col2</td>
<td>Row1 - Col3</td>
</tr>
<tr>
<td>Row2 - Col1</td>
<td>Row2 - Col2</td>
<td>Row2 - Col3</td>
</tr>
<tr>
<td>Row3 - Col1</td>
<td>Row3 - Col2</td>
<td>Row3 - Col3</td>
</tr>
</table>

Output
Row1 - Col1 Row1 - Col2 Row1 - Col3
Row2 - Col1 Row2 - Col2 Row2 - Col3
Row3 - Col1 Row3 - Col2 Row3 - Col3
Background image of the row

<table border="1">
<tr>
<td>Row1 - Col1</td>
<td>Row1 - Col2</td>
<td>Row1 - Col3</td>
</tr>
<tr background="image/back.gif">
<td>Row2 - Col1</td>
<td>Row2 - Col2</td>
<td>Row2 - Col3</td>
</tr>
<tr>
<td>Row3 - Col1</td>
<td>Row3 - Col2</td>
<td>Row3 - Col3</td>
</tr>
</table>

Output
Row1 - Col1 Row1 - Col2 Row1 - Col3
Row2 - Col1 Row2 - Col2 Row2 - Col3
Row3 - Col1 Row3 - Col2 Row3 - Col3
Background image of the cells

<table border="1">
<tr>
<td>Row1 - Col1</td>
<td background="image/back.gif">Row1 - Col2</td>
<td>Row1 - Col3</td>
</tr>
<tr>
<td>Row2 - Col1</td>
<td background="image/back.gif">Row2 - Col2</td>
<td>Row2 - Col3</td>
</tr>
<tr>
<td>Row3 - Col1</td>
<td background="image/back.gif">Row3 - Col2</td>
<td>Row3 - Col3</td>
</tr>
</table>

Output
Row1 - Col1 Row1 - Col2 Row1 - Col3
Row2 - Col1 Row2 - Col2 Row2 - Col3
Row3 - Col1 Row3 - Col2 Row3 - Col3