...

View Full Version : background images



rjkd
01-11-2003, 03:21 PM
Hello I'm pretty new to this forum, need help on images and stuff basically how to insert them as background images in websites. The actual code would help. Is it possible to reference an image without sourcing it. eg "e:\images\bg.gif"? is it possible to omit the drive where it is located and if so how?:)

ivy
01-11-2003, 04:10 PM
Hi rjkd

The best way of doing this is to use CSS.

You will need to put the following bit of code within your <head> </head> tags:



<link rel="stylesheet" href="theCSSfilename.css" type="text/css">


Then you need to use the following code and save it as theCSSfilename.css:



BODY { BACKGROUND: #99CC33 url(images/theIMAGEfilename.gif) no-repeat fixed center center}


In actual fact, you should perform the above two tasks the other way around! But hopefully you get the idea.

Change "theCSSfilename.css" to whatever you want, so long as you keep it suffixed with .css
The same goes for "images/theIMAGEfilename.gif".

The above code keeps the image in the centre of the page always - that is, it doesn't scroll, it just stays put (fixed).

There is a javascript for doing this too which you can put within the html.

The best way is to make the css file as you can then add other styles to your web pages. Also, as it is calling styles from an external file, you can change your web page styles all at once by changing one file as opposed to changing many pages which is very time consuming.

Hope this helps.

Mr J
01-11-2003, 04:14 PM
rjkd

If you are new to the wonders of creating a web site I suggest you take it one step at a time.

CSS allows you to do far more and have a greater control over your page contents.

Whilst CSS is the way you will be going you need to have an understanding of HTML first.


To colour the background you add bgcolor=" " to the opening body tag

<body bgcolor="red">

To have an image as the background you add background=" " to the opening <body> tag

<body background="Your Image.jpg">

You do not put the drive letter for the internet use.

For more information on the basics see


www.huntingground.freeserve.co.uk/basics/intro.htm

rjkd
01-12-2003, 02:25 AM
Hey thanks for the help guys. I've done a website project before the thing is I don't have my references with me. Tend to forget even the basic stuff too .:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum