News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

adding a background image

Started by vpcabochan, August 18, 2005, 02:41:31 PM

Previous topic - Next topic

vpcabochan

How do I insert a background picture in index.template.php?

Thanks.

nokonium

You don't, you use a style sheet. To show a background image behind the whole page you need to:

Use the following ....

/* The main body of the entire forum. */
body
{
        background-image: url(background.gif);
        margin: 0px;
        padding: 0px;


The background image goes in the same folder as the style.css.

To enable the image to display properly you also need to remove the other backgronds already specified

/* This is the white header area where the title, menu bars, and header boxes are. */
#headerarea
{
        background-color: transparent;

}
/* This is the main area of the forum, the part that's gray. */
#bodyarea
{
        background-color: transparent;
}
/* And this is the bottom, where the copyright is, etc. */
#footerarea
{
        background-color: transparent;

}



vpcabochan


Stuart

#3
I'd like to change the background of my forum as well.
Does it matter what the size is of the picture I want to refer to ?
I'm not sure if it should be 800x600 or 1024x768 or any other size (which would mean that it doens't really matter).

Cheers,
Stuart

1MileCrash

it doesnt matter. The image will simply repeat itself untill it fits the whole screen.
The only thing php can't do is tell you how much milk is left in the fridge.



tentronik

#5
QuoteDoes it matter what the size is of the picture I want to refer to ?
Yes you could use a e.g. 1 pixel width 1000 pixel height rich color image and just repeat it x-axis, so you safe bandwidth and you have an always filling background.

You could also add

background-image: url(background.gif) no-repeat; //for no repeat
background-image: url(background.gif) repeat-x; //only x axis
background-image: url(background.gif) repeat-y; //only y-axis

And you could even use
background-attachment for let the background image scroll or fixed.
background-position:  top center;

http://www.w3schools.com/css/css_background.asp

Advertisement: