The background attribute of the TABLE, TR, and TD (TH) elements specifies the background image of the table.
<table background="back.gif"> : Applied to an entire table. ![]()
![]()
![]()
<tr background="back.gif"> : Applied to all cells in a row. ![]()
![]()
<td background="back.gif"> : Applied to one cell. ![]()
![]()
![]()
| Attribute | Value | Explanation |
|---|---|---|
| background=" " | URL | the URL of the image to display |
Extension attribute. (Non standard attribute)
Use CSS instead of this attribute. Please see the "Related Document" for details on CSS.
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>
| 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>
| 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>
| Row1 - Col1 | Row1 - Col2 | Row1 - Col3 |
| Row2 - Col1 | Row2 - Col2 | Row2 - Col3 |
| Row3 - Col1 | Row3 - Col2 | Row3 - Col3 |