Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stretched image in a cell

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
Hi,

Is it possible to have an image as the background to a cell in a table, so that the image stretches to fill the cell rather than repeats within it?

I need to be able to put text in the cell and so the image needs to be part of the background as opposed to being an image object.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
You can't stretch an image as the background of a container.

You could place the image in a container (and set the width/height so that it stretched to fit a specific dimension), give that container absolute positioning and a low z-index - and then position it behind the table cell.

This mimics the behaviour of a background image.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Thanks Jeff. That's a bit advanced for me, I don't suppose you know of a page where this has been implemented so that I can get the gist of it?

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
It was just a series of thoughts I was following. I'm sure someone has tried it - I have no links for you.

I would advise you to avoid using this technique -- there has to be a better way of achieving the visual result you are looking for.

Maybe you could use a correctly sized image? Maybe that's the way forward...

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Actually, with the technique described it would actually be better to have a relatively positioned table cell and inside an absolutely positioned image of 100% width and 100% height. Since it is absolutely positioned, it won't interfere with the rest of the objects and since it is inside and 100% it should grow with the cell. Theory works...
 
OK well let me ask this a different way then, how do you fill a cell with a gradient colour (say light-blue to dark-blue) regardless of the width of the cell?

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Is gradient going from left to right, so the gradient is stretching out or is it going top to bottom and it only needs to be repeated?
 
Left to right please! Or if you're Arabic, right to left.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top