sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Thierry Schembri's Avatar

<tr> background


Question posted by: Thierry Schembri (Guest) on July 21st, 2005 03:00 AM
Hi !

I'm facing problems with a background image in a table (with IE & Opera), it
works with FF :
the <tr> has a background image, but the background repeats in each <td>

ex :

tr background -> "this is the background"

instead of displaying :

<td>this is</td><td>the backgroud</td>

it displays :

<td>this is</td></td>this is</td>

Is there a workaround to avoid this problem ?

Thanks in advance



5 Answers Posted
Christoph Päper's Avatar
Christoph Päper July 21st, 2005 03:00 AM
Guest - n/a Posts
#2: Re: <tr> background

Thierry Schembri:[color=blue]
> the <tr> has a background image, but the background repeats in each <td>[/color]

Please provide code.

tr {background-image: url(foo.bar)}

should work.
Thierry Schembri's Avatar
Thierry Schembri July 21st, 2005 03:00 AM
Guest - n/a Posts
#3: Re: <tr> background

Hello, here is the code :

<style>

table.tb tr
{
background: url(mid.gif') repeat-y;
}

</style>

</head>
<body>
<table class="tb">
<tr><td>cell 1</td><td>cell 2</td><td>cell 3</td></tr>
</table>

simple isn't it ?

The 'mid.gif' image is an image for the background of each line of the
table.
It works as supposed with Firefox, but with IE and Opera, the image is
repeating for each cell (and if I add : table.tb td
{background:transparent}, there's no background at all with IE & Opera).

Do you see what I mean ?


Seefor's Avatar
Guest - n/a Posts
#4: Re: <tr> background


"Thierry Schembri" <tschembri@hydromail.net> wrote in message
news:42aef07d$0$11685$8fcfb975@news.wanadoo.fr...[color=blue]
> Hello, here is the code :
>
> <style>
>
> table.tb tr
> {
> background: url(mid.gif') repeat-y;
> }
>
> </style>
>
> </head>
> <body>
> <table class="tb">
> <tr><td>cell 1</td><td>cell 2</td><td>cell 3</td></tr>
> </table>
>
> simple isn't it ?
>
> The 'mid.gif' image is an image for the background of each line of the
> table.
> It works as supposed with Firefox, but with IE and Opera, the image is
> repeating for each cell (and if I add : table.tb td
> {background:transparent}, there's no background at all with IE & Opera).
>
> Do you see what I mean ?
>
>[/color]

could you not assign a class to the first cell of each row?

table.tb td.pic
{
background: url(mid.gif) repeat-y;
}

<table class="tb">
<tr><td class="pic">cell 1</td><td>cell 2</td><td>cell 3</td></tr>
<tr><td class="pic">cell 4</td><td>cell 5</td><td>cell 6</td></tr>
</table>


Janusz 'Kali' Kaliszczak's Avatar
Janusz 'Kali' Kaliszczak July 21st, 2005 03:00 AM
Guest - n/a Posts
#5: Re: <tr> background

Thierry Schembri napisa³(a):[color=blue]
> Hello, here is the code :
>
> <style>
>
> table.tb tr
> {
> background: url(mid.gif') repeat-y;
> }
>
> </style>
>
> </head>
> <body>
> <table class="tb">
> <tr><td>cell 1</td><td>cell 2</td><td>cell 3</td></tr>
> </table>
>
> simple isn't it ?
>
> The 'mid.gif' image is an image for the background of each line of the
> table.
> It works as supposed with Firefox, but with IE and Opera, the image is
> repeating for each cell (and if I add : table.tb td
> {background:transparent}, there's no background at all with IE & Opera).[/color]

try
table.tb tr td {
background: transparent none;
}

AFAIR CSS spec. says that background-color may be set to "transparent",
but background-image to "none".




--
Janusz 'Kali' Kaliszczak
+ pies rasy *jumnik*
=> http://www.deviantart.com/view/18982956/ <= GG#52055
Thierry Schembri's Avatar
Thierry Schembri July 21st, 2005 03:01 AM
Guest - n/a Posts
#6: Re: <tr> background

interesting ... and strange

with <td> background-image set to none :

firefox : cells use correctly the <tr> background without repeating the
image
opera : each cell repeats the <tr> background
ie : no background at all

mmm I just wanted to use css instead of old methods with tables layouts. I
realize it's really difficult to make such trivial things with so limited
features & so uncompatible browsers...


 
Not the answer you were looking for? Post your question . . .
196,842 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,842 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors