1

On every Twitter profile page there is fixed background image. How could I do the same on my site?

I would like to find a solution in CSS

Termininja
  • 6,620
  • 12
  • 48
  • 49
Akos
  • 1,997
  • 6
  • 27
  • 40

4 Answers4

3

You can use background-attachment for your image

background-attachment:fixed;

try it here

Jan Vorcak
  • 19,261
  • 14
  • 54
  • 90
0

Use background-attachment: fixed; in CSS. Example CSS:

body {
background-image: url('bg.png');
background-repeat: no-repeat;
background-attachment: fixed;
}
Akos
  • 1,997
  • 6
  • 27
  • 40
  • Did you just answer your own question, 2 minutes after asking? – Tom van der Woerdt Nov 27 '11 at 13:15
  • @TomvanderWoerdt It is allowed. Check out http://meta.stackexchange.com/questions/12513/should-i-not-answer-my-own-questions on meta... – Akos Nov 27 '11 at 14:59
  • I know, but why bother asking a question if you're going to post the answer after 2 minutes? ;-) – Tom van der Woerdt Nov 27 '11 at 15:02
  • ;) Well interesting question, but I think it is OK because StackOverflow is a knowladge base. [As Jeff Atwood repeatedly states in the podcasts: "this site is about building a knowledge base."] So to help other people. – Akos Nov 27 '11 at 15:04
0

This http://www.w3schools.com/cssref/pr_background-attachment.asp should be helpful.

Hauleth
  • 22,873
  • 4
  • 61
  • 112
0

background-attachment: fixed should to the trick.

http://www.w3.org/wiki/CSS/Properties/background-attachment

Philippe Plantier
  • 7,964
  • 3
  • 27
  • 40