HOME       >>       Websites and Web Designing

Php Picture Background.


I am a beginner with PHP and I was just just wondering how to put a picture background on my online store website. This is currently in development and its temporary home is http://forums.xisto.com/no_longer_exists/

If you need the code your browser should be able to get it when you visit the website.

Any help is greatly appreciated.


Placing a background image is not just PHP programming. This is a basic HTML coding or CSS coding.

Since your site is open source os commerce, look for in stylesheet.css related to body or background.

Place CSS code

body {background-image: url('image/location/name.ext');}

There are other settings that background-image use such as repeat or no repeat, background default color, margin etc. Look up this property and apply them correctly.

Also, since your site uses table, be sure to attribute table correctly. Otherwise, you'll have white blanks where table is shown.


Just to expand on this...PHP is a backend language. It never sees the light of day, all it does is spit out other languages and HTML is the one used to create webpages (usually) so you will also need to learn HTML and some CSS in order to be able to create webpages with PHP.Also beware that using a large image for a background will make your website slow to load, it is advisable to only use a tileable image (IE one that you can copy and paste next to itself and not notice the joins) or even better to use coloured areas with carefully placed images arranged using CSS as image backgrounds generally look old and tacky


Try the below script to add Background Image Using PHP

$random = array(
'URL to image',
'URL to image',
'URL to image'
header("Location: $random[0]");

ok, i only used 3 images but you can add more
just that last one where you put the image URL
cannot have a comma at the end because its ending the list

once you have inputed the URL's upload
*note all images do not have to be same size unless your putting them into the second code i give

once you have them uploaded just input the URL to the PHP script into the code given below

*note the code below is just the easiest and most common code people will use
there are other ways to use this code
such as the CSS Rollover Script i contributed a while back
or to place it in a regular image would be more difficult
you would have to make each image the same dimensions
and place the php script as a background image such as:

<div style="background-image:url('URL TO PHP SCRIPT'); width:XX; height:XX; overflow:hidden; visibility:visible">


Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.