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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

make that web background stretch

Status
Not open for further replies.

northernbeaver

Programmer
Jul 9, 2001
164
CA
Im sorry for posting this as I am sure that it has been asked before but because the search function seems to be temporaraly down and I cant locate the answer. I have a html web site but I would like the background to fit the entire background of the page, the image is designed for 800X600 res but anyone who views it any larger then that get the tiling effect which ruins the whole effect of the page. My question is this, which language or method is the easiest and less upkeep to create? any thoughts?
 
You can't stretch the background image but you have options with positioning the image. You can start by centering it:
background: url(bg.gif) no-repeat 50% 50%;

With this the edges would be cut off or blank space will show evenly around the sides with respect to varying resolutions. The bg color can match the image so the seam is invisible or the image can be made large enough that the edges are never seen.

Maybe someday CSS will specify a rule to stretch a background image from edge to edge, especially as vector graphics get more popular, but there's nothing now. Somebody smack me if I'm wrong.

petey
 
You can stretch the background by placing two layers on top of one another, and on the bottom layer, use javascript to document.write() the <img> tag with the dimensions of the user's window. Then on the top layer, put your content with a transparent background.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top