PDA

View Full Version : Background question



ofrandom
February 1st, 2007, 10:58 AM
I was wondering if there was a way to make the background image fit the size of the page perfectly without having to change the image's size. I have been asked by a lot of people if that was possible and I can't answer since I haven't done it yet.

Anyone?

Thank you. ^__^

borrob
February 1st, 2007, 04:57 PM
<HTML>
<HEAD>
<TITLE></TITLE>
<META NAME="author" CONTENT="Rob">
<META NAME="generator" CONTENT="Ulli Meybohms HTML EDITOR">
<STYLE TYPE="text/css">
<!--
.bg
{
position:absolute;
height:100%;
width:100%;
z-index:-1;

}
-->
</STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#FF0000" ALINK="#FF0000" VLINK="#FF0000">
<div class="bg"> <img SRC="your_bg_img.gif" WIDTH="100%" HEIGHT="100%" BORDER="0" ALT=""></DIV>

</BODY>
</HTML>
this works! for i.e haven't tested it in other browsers

good luck

ofrandom
February 1st, 2007, 08:45 PM
<!--
.bg
{
position:absolute;
height:100%;
width:100%;
z-index:-1;

}
-->

That .bg class is the important part right? But if I use it with the body the bg image still doesn't fit the page o.o for the image it works though...

borrob
February 2nd, 2007, 02:40 AM
The z-index:-1 tells the class that it is in a layer in the background. So everything else that is in layer 1 is over this background. So keep the div and put the rest of the content in the html file. it will be drawn over the div in the background.

ofrandom
February 2nd, 2007, 08:35 AM
Oh alright.
Thank you very much ^^