views:

59

answers:

5

How can we integrate a picture as a background image for a table..

  <table>
  <tr>
  <td><textarea>Some data here.....</textarea>
  </td>
   <td></td>
  </tr>
  <tr>
  <td><textarea>Some data here.....</textarea>
  </td>
   <td></td>
  </tr>

Thanks..

A: 
table {
    background-image: url(/images/foo.png);
}
David Dorward
+5  A: 

Are you asking how to assign a background image to a table? Like for any other HTML element.

In CSS:

table.mytable
 { background-image: url(your_image.gif); }

In HTML:

<table class="mytable">

Reference:

background-image property at w3schools

see that page for the additional parameters background-repeat and background-position.

Pekka
It's worth noting that the background for the table-row will appear above the background of the table, and the table-cell background-image will appear above that of the table-row, so you might need/want to assign `background-color: transparent;` to `tr, td`.
David Thomas
A: 

following on from Pekka's example.

table.mytable td
 { background-image: url(your_image.gif); }

would let you put a background image in each cell

if you applied a class attribute to the <td class="myClass"> you could then add a custom background to individual cells.

sidcom
+1  A: 

Simply?

<table style="background-image: url(your_image.gif);">
...
</table>
gmunkhbaatarmn
A: 

inline css like - style="background-image: url(your_image.gif);" - is not quite good.

in my opinion best way to put bg to table is ;

html : table > tr > td.wide

css : table tr td.wide{background:#ffffff url(/images/bg.png) repeat;}

spielersun