How to stretch a website background

How to stretch a website background

The markup language of HTML allows the web designer to use any image as the background drawing. However in the language not enough built-in control facilities background pictures. More granular control is carried out by means of CSS cascading style sheets. Instruction 1. To make the background stretched on all width of the browser it is necessary to use the z-index parameter in CSS. It allows to set an order to the created elements. The more the value of this attribute, the above the block will be located on the page. 2. Create new documents in HTML format and css (the right mouse button – "Create" - "Text file") and open them by means of any text editor. 3. Arrange the background picture on a low layer. It will stretch depending on display resolution. On top other element on which page contents will be displayed will be located. That to carry out it, create two
blocks. In the css file write:.1layer {z-index: 1; width: 100%height: 100%position: absolute; }.2layer {Position: absolute; z-index: 2; } position Parameter: absolute allows to set absolute positioning, i.e. the layer will be placed regardless of other elements. 4. Include the created CSS code in the HTML-file by means of the binding link tag: of page Background 5. Create a new layer. By means of the tag place on it the picture. For example:
<" 2layer"> page Contents
For img is set by div class= only width parameter as if to specify in addition height, in some browsers the image deformation will appear. 6. Save the made changes. To check the written code, increase the page in a browser window. The background drawing should increase too.

Author: «MirrorInfo» Dream Team


Print