Go Back   SitePoint Forums > Forum Index > Design Your Site > Web Page Design
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Jul 28, 2008, 18:22   #1
visualkreations
GRAPHIC DESIGNER
 
visualkreations's Avatar
 
Join Date: Sep 2005
Posts: 150
Background image in a <TR> doesnt work in IE!

I'm have a problem with a background image in a table with IE , it
works with FF :
I have a table, the <tr> has a background image, but the background repeats in each <td>
__________________
My Portfolio The Best Designs Blog
visualkreations is offline   Reply With Quote
Old Jul 29, 2008, 07:45   #2
visualkreations
GRAPHIC DESIGNER
 
visualkreations's Avatar
 
Join Date: Sep 2005
Posts: 150
this is the code

<table width="500" height="143" border="0" cellpadding="10" cellspacing="0">
<tr style="background:url(http://www.google.ca/intl/en_ca/images/logo.gif) no-repeat bottom">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
__________________
My Portfolio The Best Designs Blog
visualkreations is offline   Reply With Quote
Old Jul 29, 2008, 11:36   #3
zcorpan
bronze trophy
 
Join Date: Dec 2004
Location: Sweden
Posts: 2,515
Known bug. There's a workaround using expressions and offsetLeft/offsetTop but I'm too lazy to dig it up/rewrite it right now.
__________________
Simon Pieters
(works for Opera Software, though represents just himself)
zcorpan is offline   Reply With Quote
Old Jul 29, 2008, 16:22   #4
123extra
SitePoint Member
 
Join Date: Dec 2007
Posts: 6
if you can put in TR tag, then why not make the image crop then put in TD
123extra is offline   Reply With Quote
Old Jul 29, 2008, 21:07   #5
visualkreations
GRAPHIC DESIGNER
 
visualkreations's Avatar
 
Join Date: Sep 2005
Posts: 150
Quote:
Originally Posted by zcorpan View Post
Known bug. There's a workaround using expressions and offsetLeft/offsetTop but I'm too lazy to dig it up/rewrite it right now.
If you get a chance to find where i can see this fix , i would really appreciate that.
__________________
My Portfolio The Best Designs Blog
visualkreations is offline   Reply With Quote
Old Aug 12, 2008, 14:50   #6
zcorpan
bronze trophy
 
Join Date: Dec 2004
Location: Sweden
Posts: 2,515
Code:
tr { background-image:url(foo); }
td { background-position:expression(-this.offsetLeft); }
or for tbody:
Code:
tbody { background-image:url(foo); }
td { background-position:expression(-this.offsetLeft + " " + -this.offsetTop); }
__________________
Simon Pieters
(works for Opera Software, though represents just himself)
zcorpan is offline   Reply With Quote
Old Aug 13, 2008, 14:45   #7
wiz241
SitePoint Enthusiast
 
wiz241's Avatar
 
Join Date: Jun 2007
Location: Oregon/Maryland
Posts: 75
I would suggest you just nest another <table> within the <tr> and put an image background for that.
__________________
Hostamina - Hosting You Can Rely On!
- Providing High Quality Hosting with Personalized Support
- Will help you install, configure, and even build your website.
- No Overselling! Get Hosted on Fast Servers with 99.9% Uptime!
wiz241 is offline   Reply With Quote
Old Aug 13, 2008, 19:13   #8
felgall
Programming Since 1978
silver trophybronze trophy
SitePoint Award Recipient
 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, NSW, Australia
Posts: 13,101
I'd suggest only using tables for their intended purpose of displaying tabular data where the content will be easier to read without a background image.
felgall is offline   Reply With Quote
Old May 10, 2009, 17:29   #9
petree69
SitePoint Member
 
Join Date: May 2009
Posts: 1
Hey, if you want it to work for all browsers, including Firefox AND IE, you have to make a background image in the td. For example:

<table>
<tr><td background="image/urimage.jpg">
Hello. Now you have a background image.
</td></tr>
</table>

However, if you have more than one TD in the same TR, the background image will only show up in the specified TDs and if you make it in all of them, it will look like you tiled the background image. So there is no way to make it work for more than one browser unless you can find a way to do it with css. Sorry.
petree69 is offline   Reply With Quote
Old May 10, 2009, 23:05   #10
Erik J
Design Your Site Team
bronze trophy
 
Erik J's Avatar
 
Join Date: May 2007
Location: Countryside, Sweden
Posts: 3,217
Hi petree69, welcome to SitePoint!

You suggestion was already mentioned in post #4.
Then Simon gave the fix asked for in IE in post #9.

Anyway, glad to have you on board!
__________________
Happy ADD/ADHD with Asperger's
Erik J is offline   Reply With Quote
Old Jul 9, 2009, 05:58   #11
adarshkp
SitePoint Member
 
Join Date: Jul 2009
Posts: 1
<table>
 <tr style="background: url(/images/tr-background.gif) no-repeat 0 0;">
  <td>Row 1</td>
  <td>Row 2</td>
  <td>Row 3</td>
 </tr>
</table>

This doesn't work in IE6 or Safari, even if you set the <td> background element to 'transparent' or 'none'.

But you can still make it happen with just the one image:

<table>
 <tr>
  <td style="background: url(/images/tr-background.gif) no-repeat 0 0;">Row 1</td>
  <td style="background: url(/images/tr-background.gif) no-repeat 50% 0;">Row 2</td>
  <td style="background: url(/images/tr-background.gif) no-repeat 100% 0;">Row 3</td>
 </tr>
</table>

You're just altering the background-position of the image, so that what should be on the left goes on the left (at 0), the middle part goes to the middle (50% horizontally), and the last part goes at the end (100%). Remember that values in the background-position element are ordered horizontal, then vertical, unlike the margin and padding elements.

This will fix the issue.

Adarsh K.P.
adarshkp is offline   Reply With Quote
Old Jul 12, 2009, 09:38   #12
Stomme poes
Site Point Member
 
Stomme poes's Avatar
 
Join Date: Aug 2007
Location: Netherlands
Posts: 5,955
Is Safari still buggy with this?? I thought it was fixed.
Stomme poes is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

 
Forum Jump


All times are GMT -7. The time now is 10:04.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved