Interview Questions

How do I have a fixed (non-scrolling) background image?

CSS Interview Questions and Questions

(Continued from previous question...)

33. How do I have a fixed (non-scrolling) background image?

With CSS, you can use the background-attachment property. The background attachment can be included in the shorthand background property, as in this example:

body {
background: white url(example.gif) fixed ;
color: black ;

Note that this CSS is supported by Internet Explorer, Mozilla, Firefox Opera, Safari, and other browsers. In contrast, Microsoft's proprietary BGPROPERTIES attribute is supported only by Internet Explorer.

(Continued on next question...)

Other Interview Questions