Forum Moderators: open

Message Too Old, No Replies

Cross-browser image stretchability

         

rufusputnam

10:55 pm on Jun 11, 2006 (gmt 0)

10+ Year Member



What I want is to make my image, which I have divided into table cells in order to make some of the cells into links, stretch to the edge of any browser window, so that there is no space around it, no visible margins.

Here's a quote from this forum in 2002:

"Create a very wide image (much wider than any real resolutions) and place it in table cell with %-specified width. This will create a feel that the image is adapted for specific resolution and fills entire screen.
This technique is widely-spread, look at professional sites with fluid design and you'll find a lot of examples."

Is this still the best way?

Or would this css:

<style type="text/css">
p.margin {margin: 0cm 0cm 0cm 0cm}
</style>

work for images as well as text?

And, in general, is css as browser-flexible as tables are?

garann

8:18 pm on Jun 12, 2006 (gmt 0)

10+ Year Member



Using CSS, you're not going to be able to use your image slices as background images for any type of element and have them scale like they would as the background of a table cell. However, I think you can just set the width and height of the images to the percentages you'd like and use CSS to set the margins to zero and position them absolutely.

encyclo

10:02 am on Jun 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The advantage with the CSS method is that you can set the image as a background to the
body
element, and repeat it along the x-axis so it always covers the entire horizonal width of the screen. This is more flexible tha the older method of using a 100% width table cell.

body {
background:#fff url(/path/image.jpg) repeat-x 0 0;
}

rufusputnam

7:27 pm on Jun 13, 2006 (gmt 0)

10+ Year Member



Thank you for your replies.

I see the advantage of making a background image for stretchability. My only fear is that it won't show on some browsers. How would you rate the reliability of the code you suggest?