How to add a background on the site

How to add a background on the site

The background in an initial code of web pages, depending on the used design, can be set by either the indication of color, or an image link to file with addition of parameters of its positioning. It can be made directly in HTML tags, in the separate CSS block in heading part of a source code or in the separate file with descriptions of styles.

The sponsor of placement P&G As flash to publish Articles on the subject "How to Add a Background on the Site" on the website How to make the counter of visits How to clean a reference frame

Instruction

1

Open an initial code of that block which is used on your site for a task of a background of its pages. When using any control system this block is, as a rule, allocated in the separate file. The control system has tools for its editing directly in the browser. Depending on concrete system this procedure can be organized differently - for example, through the editor of pages. If you do not use a control system, the corresponding file should be downloaded to itself in the computer and to open in any editor. The specialized HTML editor is better to use, but it is possible to use also the simplest Notebook.

2

Add to the body tag the bgcolor attribute with the indication of a color shade if color, but not the picture has to be a background of the page. For example:

Here dark orange color as a background is specified. Not any text ("mnemonic") name of a shade is able to distinguish the browser therefore it is better to use a hexadecimal code of color. For example, to dark orange color there corresponds the FF8C00 code:

3

Use the background attribute instead of bgcolor in the body tag if the background has to be set by the image, but not color. For example, if the file with the background image is called as bgPic.gif and lies on the server in the images folder, the body tag can be written down so:

4

Place the description of styles if you wishif you wish to set a page background with use of the CSS language in heading part of an initial code. For example, the description of styles in the CSS language replacing the dark orange color specified in the body tag as a background can look so:


body { background-color: DarkOrange; }

And it is possible to set the background picture such description of styles:


body { background: #FF8C00 url(images/bgPic.gif) repeat-y; }

Here except the reference to the picture also background color is specified (#FF8C00) - if on the page there are places which are not closed by the background image, they will be painted in the color shade specified here. The repeat-y parameter sets repetition of the background image on a vertical (along axis Y). If it is necessary to repeat the image across, it is necessary to use repeat-x value, and for a ban of repetition of drawing - no-repeat. It is possible to place the description of styles before the tag closing heading part of a HTML code.

5

Keep the made changes in the editor of pages, or save and load the downloaded file back on the server if editing a code was made in the file on your computer.