Deprecated in HTML5. Do not use.

<tr background="">

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Attribute of
Code Example For Tr In HTML (To Organize Table Rows)
What does <tr background=""> do?
Identifies the URL of a file to be used as a background image for a table row.

Code Example

<table>
  <tr background="/wp-content/uploads/wov.png">
    <td>First column</td>
    <td>Second column</td>
    <td>Third column</td>
  </tr>
  <tr>
    <td>First column</td>
    <td>Second column</td>
    <td>Third column</td>
  </tr>
  <tr background="/wp-content/uploads/wov.png">
    <td>First column</td>
    <td>Second column</td>
    <td>Third column</td>
  </tr>
</table>
First columnSecond columnThird column
First columnSecond columnThird column
First columnSecond columnThird column

Using a Background Image with Table Rows

In the past, the background attribute was used to identify the URL of an image file to be used as a background image for a table row. Typically, the selected image file was a small image that was repeated over and over to cover the entire background. This attribute has been deprecated, but you can still accomplish the same thing with the CSS background property.

<style> .example-table tr:nth-child(2n+1) {   background: url("/wp-content/uploads/wov.png"); } </style> <table class="example-table">   <tr><td>First column</td><td>Second column</td><td>Third column</td></tr>   <tr><td>First column</td><td>Second column</td><td>Third column</td></tr>   <tr><td>First column</td><td>Second column</td><td>Third column</td></tr> </table> 

This bit of code will apply the same background pattern image to every other table row beginning with the first.

.example-table tr:nth-child(2n+1){background: url(“/wp-content/uploads/wov.png”);}

First columnSecond columnThird column
First columnSecond columnThird column
First columnSecond columnThird column

Background pattern image courtesy of Subtle Patterns.

Adam is a technical writer who specializes in developer documentation and tutorials.