ploppy Posted December 28, 2006 Share Posted December 28, 2006 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 More sharing options...
specialguy Posted December 28, 2006 Share Posted December 28, 2006 Don't think so it's a good idea to use css when you're using tables.if you wanna use tables, you should put your css into xhtml, and if you wanna use css, then you have to build your xhtml with Divs. Link to comment Share on other sites More sharing options...
ploppy Posted December 28, 2006 Author Share Posted December 28, 2006 thx special. could you give me example please how you would code it? Thx peter Link to comment Share on other sites More sharing options...
PrateekSaxena Posted December 28, 2006 Share Posted December 28, 2006 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 More sharing options...
ploppy Posted December 28, 2006 Author Share Posted December 28, 2006 thx prateek. do i just substitute background-color:red; to background-image: url(images/image.jpg); if so, how do i put this command into table. have tried <td width="46%" class="some"></td> but it shows as thin line. thx. Link to comment Share on other sites More sharing options...
jesh Posted December 28, 2006 Share Posted December 28, 2006 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 More sharing options...
specialguy Posted December 29, 2006 Share Posted December 29, 2006 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 More sharing options...
jlhaslip Posted December 29, 2006 Share Posted December 29, 2006 Better give the code for the background image as well, since that is the issue which started this topic.. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now