<table background=""><tr background=""><td background="">
Browser |
|
---|---|
Type |
|
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
<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
<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
<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