View Full Version : Can someone please help me?


confused james
04-16-2004, 02:17 AM
I've only just started working with css, and I cant get a background image on my site. Can someone please give me the code and tell me where to put it?
Thanks

kicker91
04-16-2004, 02:19 AM
<style type="text/css">
body { background-image:url("imageurl.gif"); }
</style>

:)

confused james
04-16-2004, 02:23 AM
ummm.... it doesnt work, I've got it in the center column of my page, I'll just show you that bit.

#center {
margin-left: 200px;
padding: 0px;
margin-right: 200px;
top: 0px;
}

are you sure I am supposed to put the code in there? :idea:

kicker91
04-16-2004, 02:25 AM
Then you'd add that code into there. :)

#center {
background-image:url("bla.gif");
margin-left: 200px;
padding: 0px;
margin-right: 200px;
top: 0px;
}

confused james
04-16-2004, 02:26 AM
its still not working :(

lefty
04-16-2004, 02:32 AM
Mind posting a link to your page?

confused james
04-16-2004, 02:36 AM
ok... its just basic off the css help...
http://www.geocities.com/b4igogetmyowndomain

lefty
04-16-2004, 02:39 AM
<style type="text/css">
<!--

add that, and also:

-->
</style>

confused james
04-16-2004, 02:41 AM
<!--
and
-->?

confused james
04-16-2004, 02:42 AM
didnt work :\

kicker91
04-16-2004, 02:48 AM
Add height="100%" width="100%" to the div.

confused james
04-16-2004, 02:49 AM
will do...

confused james
04-16-2004, 02:51 AM
are you sure in the div? because then it just shows up height="100%" width="100%" on front page. You sure u not mean the other part

kicker91
04-16-2004, 02:52 AM
To the <div> tag. ;)

confused james
04-16-2004, 02:55 AM
still no work :(

confused james
04-16-2004, 02:58 AM
i gotta go... ill try again later :)

Rosey
04-16-2004, 04:02 AM
the reason it's not working is because you have no content in the center at all. The div is empty.

Adding width and height won't do anything but once you start writing your content it will show.

confused james
04-16-2004, 07:43 AM
i did- didnt work :(

confused james
04-16-2004, 07:47 AM
oh it did! i just put more in. How do i get it so it does the middle part of the page rather than just where the text is?

salomeyasobko
04-16-2004, 08:08 AM
oh it did! i just put more in. How do i get it so it does the middle part of the page rather than just where the text is?
so what does the middle part of the page?

confused james
04-16-2004, 08:11 AM
???

salomeyasobko
04-16-2004, 08:12 AM
you said: How do i get it so it does the middle part of the page rather than just where the text is?

i don't understand what you want to happen in the middle part of the page.. refering to something as "it" isn't very explanatory ;)

confused james
04-16-2004, 08:16 AM
oh sorry lol. I wanted the background to fill the WHOLE page, (bar the left and right columns) rather than just where text was.
I just put <br> now...
is there a better way?

salomeyasobko
04-16-2004, 08:24 AM
you can't make a background stretch across the whole page. you'll have to edit it in a graphics program to make it big enough, sorry :(

i don't see how <br> would help though :lol: you can position the background image to wherever you want it to be. use this code:

<style type="text/css">
body
{ background-image: url(image.gif); background-position: number of pixels from the top number of pixels from the left
}
</style>

edit the bold parts

confused james
04-16-2004, 08:29 AM
the background 'stretches' over where the text is. Or rather, where the <Br> is

Calidris
04-16-2004, 09:10 PM
the background 'stretches' over where the text is. Or rather, where the <Br> is
It "repeats" across and down the page. You can make it affect the entire page by placing the style in a different selector (you currently have it in the #center selector).

So... your code would become this to make the background fill the whole screen:
body { background-image: url("bg1.gif"); }
and you could remove the similar line from the #center selector... as it might not align very well with the body background.

Note: <br> is for line breaks, so if possible you should avoid using more than one of them in a row.

confused james
04-17-2004, 12:51 AM
but i dun want it all over the page, only in the center column