Forum Moderators: phranque

Message Too Old, No Replies

NO Repeat for images in HTML

How do you stop imag repeat in web page?

         

gtd77

4:53 pm on Jun 12, 2004 (gmt 0)



I'm building a simple web page with an image (jpg) as background. How do I get it to stop repeating and how do I get text to remaim centered in the image?

TIA,

George

ronin

7:29 pm on Jun 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi George, welcome to Webmaster World!

Try this somewhere between the <head> and </head> tags in your document:


<style>
body {background: url(bg.jpg) #fff no-repeat top left fixed; text-align:center;}
</style>

You'll need to replace bg.jpg with the relative filepath of your background image (no need to enclose the filename in quote marks).

Also, you'll need to replace #fff with your chosen background colour.

e.g. if the background colour is bright red and you would normally use:

<body bgcolor="#FF0000">

you would use #f00 in the CSS styling above.