It is frequently asked – but I haven’t seen a good answer yet (and I looked). If you set a background image in CSS to a table row- the image will repeat itself in every cell. If you set the position: relative
(for the row) and set the background-image: none
(for the cells) it solves the problem on IE but not on chrome! I can't use background positioning since there are many calls and their size varies. (And the picture is not symmetrical- It's a fade out from one side. Anybody??
Example for the css code :
tr { height: 30px; position:relative;} tr.green { background: url('green_30.png') no-repeat left top; } tr.orange { background: url('oranger_30.png') no-repeat left top;} tr.red { background: url('red_30.png') no-repeat left top; } td { background-image: none; }
The HTML is basic - A multi cell table.
The goal is to have different colors fade into every row, but it could be any non-pattern image.
You can specify an image to set background of your HMTL page or table. Following is the syntax to use background attribute with any HTML tag. The background is deprecated and it is recommended to use Style Sheet for background setting.
In the table cell tag <td> where you would like to place the background image, paste the image attributes and values. Change the src= attribute name to the background= attribute.
You can add an image background to your HTML table cells by adding BACKGROUND="yourimage. gif" to your <TD> tag.
Ok, I spent ages reading about this, and couldn't find an easy fix for all browsers, but as I see you are using fixed height rows, I've developed my own workaround: http://jsfiddle.net/DR8bM/
Basically, instead of putting the background image on the row, you put it on an absolute-positioned div in the first cell of each row (and expand it to fill the whole row). This is slightly hacky, but may be the only reliable way to achieve what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With