Html Code for fixed Background ?

Define all the background properties in one hit:

#nameOfMyDiv{
background:url(assets/graphicsa/backgroundImage.png) fixed no-repeat top left;
}
 
The word fixed, when discussing backgrounds in html/css is used to describe how the background moves in relation to the page.

There are 2 options - fixed and scroll.

scroll - (default) The background image moves when the rest of the page scrolls

fixed - The background image does not move when the rest of the page scrolls

To add a background image and have it fixed, use:

background-image: url(your_file.gif);
background-attachment: fixed
 
Well, technically it's CSS and the code is background-attachment: fixed; Either add it inline to your tag as style="background-attachment: fixed;" or wherever else your css is.
 
Back
Top