Log in

View Full Version : A little help please?



CStorm
04-01-2008, 08:14 PM
I'm in the process of making my new site and i've found an awesome background image to use. However, when a page expands beyond the image size, it repeats and it looks rubbish.

Does anyone know the script/coding that holds the background in place but lets the layout scrolls on top of it? I appreciate any help you can give.

Jordan,
04-01-2008, 08:17 PM
need to edit the css to make it fixed somthing like backround:} fixed that isnt it but :P

Swearwolf
04-01-2008, 08:20 PM
<style type="text/css">
<!--
body {
background-image: url(url to ur bg pic); background-repeat: no-repeat; background-attachment: fixed;
}
-->
</style>
put that in head section

MrCraig
04-01-2008, 08:23 PM
Use CSS :)

In head


<style type="text/css">
<!--
body{background: url(PATH TO BACKGROUND); background-attachment:fixed;}
-->
</style>


Edit: Hoax bet me to it :(

Swearwolf
04-01-2008, 08:24 PM
mrcraig, add in the "background-repeat: no-repeat;" lolol :)

MrCraig
04-01-2008, 08:25 PM
yeah, but surely if the attachment is fixed, it wont matter if it repeats or not?

Swearwolf
04-01-2008, 08:26 PM
fair point, my bad :P

MrCraig
04-01-2008, 08:28 PM
LOL, nps :P

I was thinking about adding when coding then though "Nah, wont waste some bytes on it"

+REP for making a point :)

Jme
04-01-2008, 08:31 PM
<style>
body
{
background: url('path/to/image') fixed no-repeat;
}
</style>

CStorm
04-01-2008, 09:02 PM
Thank you for all your help guys, but when I tried using them, they either didn't work or would only show the one image and it didn't cover the whole screen. Am I doing something wrong? xD

MrCraig
04-01-2008, 09:13 PM
try..



<style type="text/css">
<!--
body{background: url(PATH TO BACKGROUND); background-attachment:fixed; background-repeat:repeat-x;}
-->
</style>

CStorm
04-01-2008, 09:20 PM
Nope, didn't work ;[

Swearwolf
04-01-2008, 09:21 PM
try change "repeat-x" to "repeat-y"

CStorm
04-01-2008, 09:25 PM
Still doesn't work xD

Swearwolf
04-01-2008, 09:28 PM
got a link to this particular page? :P

CStorm
04-01-2008, 09:36 PM
I'd give it to you but it's top-secret :P

Ini
04-01-2008, 09:40 PM
I'd give it to you but it's top-secret :P
Use something called a private message

MrCraig
04-01-2008, 10:04 PM
:o Give it to me chris? :)

Ini
04-01-2008, 10:05 PM
Give you what?

Jme
04-01-2008, 11:17 PM
The bg image must not be the size of the screen so that if you want the bg to not repeat, you're gonnahave to make your image bigger or put up with it :P

Want to hide these adverts? Register an account for free!