View Full Version : background question..


DeltaDawn
12-19-2005, 07:57 PM
how do i center a background?

neonick5647
12-19-2005, 08:03 PM
This code should do it: (replace bold w/ your things)

<style type="text/css">
body
{ background: #000000;
background-image: url(BACKGROUND IMAGE URL);
background-repeat: no-repeat;
background-position: center center; }
</style>

Put this in the <head> section of your page. :)

Hope this helped!

ssserpent
12-20-2005, 04:34 PM
Hi

I have a similar problem; my background (when put in html format) clones itself, so I end up with lots of small images instead of one big.

On the other hand, when I try it with css (what you proposed above), the picture doesn't show up at all, it's just black...

Any advice?
It looks a bit like this:

<html>
<head>

<title>Page</title>


<style type="text/css">

body
{ background: #000000;
background-image: http://img.photobucket.com/albums/v213/ssserpent/IMG_1656big.jpg;
background-repeat: no-repeat;
background-position: center center; }

</style>

</head>
</html>

What did I do wrong?

kittycat
12-20-2005, 07:20 PM
It's pretty close, just change your stylesheet to this (you'll have to fix up the image url):
<style type="text/css">

body
{ background: #000000;
background-image: url(http://img.photobucket.com/albums/v2...G_1656big.jpg);
background-repeat: no-repeat;
background-position: center center; }

</style>

ssserpent
12-21-2005, 01:33 PM
Thanks...but my background is still double!! Should I resize the image?

ssserpent
12-21-2005, 01:43 PM
I take that back, sorry! Its working now...:)

heyy_yourmine
12-21-2005, 04:34 PM
If anyone is still having that problem, you may have 2 codes for the background. Take one out or make both on no-repeat.

btw, you only have to be center 1 time.