Hack Forums
code for make the background stay on the same position? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141)
+---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50)
+---- Thread: code for make the background stay on the same position? (/showthread.php?tid=2803867)



code for make the background stay on the same position? - HackMo҉o҉N - Aug 23, 2012

How are you?

i would like to know the code for make the background stay on the same position even if you scroll down for see other part of the website
example

body {

background: black url(http://example.com/example.jpg) center;



}



thank you


* - DEFQON - Aug 23, 2012

That bit would have to be done through css

Code
body
{
background-image:url('the image');
background-attachment: fixed;
background-repeat:no-repeat;
background-position:;
}

Something like that I think


* - HackMo҉o҉N - Aug 23, 2012

how are you?
thank you for help that help


* - DEFQON - Aug 23, 2012

(Aug 23, 2012 10:03 AM)HackMo҉o҉N Wrote:  how are you?
thank you for help that help

No problem at all. You should check out the website links below, there pretty handy for CSS if you don't know something.

http://www.w3schools.com/css/
http://www.w3.org/Style/CSS/Overview.en.html

there's a lot more than that haha


* - SavageBoys - Aug 23, 2012

(Aug 23, 2012 10:25 AM)DEFQON Wrote:  No problem at all. You should check out the website links below, there pretty handy for CSS if you don't know something.

http://www.w3schools.com/css/
http://www.w3.org/Style/CSS/Overview.en.html

there's a lot more than that haha

No, http://www.codecademy.com/learn

And:
background: #000 url('') fixed no-repeat center;

Save some lines and frustration later on.