Jump to content

table background image


Recommended Posts

hi. I am trying to add background image to a cell of a table using css. This is what i have put in the style sheet but it dosen't display:

.Tablestyle { background-image: url(/images/image.gif); background-repeat: repeat; background-position: left; height: 134px;
here is the table:
<table cellpadding="0" cellspacing="0" width="100%"> <tr> <td width="66%"><img src="{$ImagesDir}/image.jpg" alt="logo" width="751" height="134" /></td> <td width="34%" valign="top" background="{$ImagesDir}/image.gif"></td> </tr></table>
I have put the background image in the table until i can sort this problem. Any ideas. Thanks.
Link to comment
Share on other sites

Hey! I dont think that tables are EVIL. I think you need to write -

td.some{ background-color:red;}

and for the HTML you can write

<table>  <tr>	<td class="some">Col1</td>	<td class="some">Col2</td>  </tr></table>

I hope this helps!

Link to comment
Share on other sites

have tried ... but it shows as thin line. thx.
I remember some other folks on here mentioning in other posts that IE doesn't apply styles to empty td cells. Try doing this instead:
<td width="46%" class="some"> </td>

Link to comment
Share on other sites

Dunno if you still want an exemple of Div/css but here it is :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title></title><style type="text/css"><!--body {  margin: 0px;  padding: 0px;}#header {  background: #0f0;  width: 100%;}#leftcol {  background: #f00;  float: left;  width: 20%;  height: 500px;}#rightcol {  background: #f00;  float: right;  width: 20%;  height: 500px;}#content {  background: #fff;  float: left;  width: 59%;  height: 500px;}#footer {  background: #0f0;  clear: both;  width: 100%;}--></style></head><body><div id="header">Header Section</div><div id="leftcol">Left Section</div><div id="rightcol">Right Section</div><div id="content">Content Section</div><div id="footer">Footer Section</div></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...