How to record a background

How to record a background

Sometimes the plan of the designer demands that the background image remained motionless when scrolling by the visitor of contents of the page. It can be made, having changed by means of instructions of the CSS language (Cascading Style Sheets - "cascade stylesheets") the installation of behavior of a background used by default.

The sponsor of placement P&G Articles on the subject "How to Record a Background" How to make a background indistinct in a photoshop How to clean a background a photoshop How to remove allocation of badges on a desktop



Add the description of styles for the body block containing background-attachment property with fixed value to the web document, and the background of the page will remain motionless when scrolling the document. This way of fixing of a background will work in all browsers supporting any of current CSS standards starting with version 1.0. Except fixed value, for this property standards provided two more options - scroll and inherit. If in descriptions of styles of the document it is not specified any value for background-attachment, by default it is considered that it is established in scroll. In this case the background will move together with scrolling of contents of the page. Inherit value specifies that for background-attachment property of this element the same value, as for its parental element has to be used.


Add a tag of the necessary page with the style attribute and place in it the description of styles fixing a background. For example, it can look so:


It is possible to specify here and the address of the background image:


Replace the address and the name of the picture (img/pic.gif) with your own values. Such way is convenient to that demands the smallest changes in a page code, however the description of styles is more often take out in the separate block in heading part of the document or even in the separate file.


If you wishIf you wish to use separate CSS block with instructions for fixing of a background of the page, place before a tag of an initial code, for example, such lines:

BODY { background: url(img/pic.gif) fixed; }

Do not forget to enter the correct name and the address of the background image instead of img/pic.gif.