Using CSS to control web page background



I think we are often more appropriate for some background on your web page picture and worry about it, that I think are some exceptions, because these pictures are not too big or too small, or too messy, is there any way to get pictures to co-own Home of appetite then? The answer is yes. Would like to know how to achieve Well, Well, we now follow me, I guarantee that all will be to learn. However, I would like the Internet, "married" friends are generally divided into the Internet that "opened" (like I do, just start pulling from the other's home page to change the relevant code), the other is in their own homes or with DW FP production of specialized software like a good upload, so, I intend to introduce separate the two steps, first in the Internet cafes in "opening" of friends the sake of it, and finally a brief introduction to some of the background to do with DW4 style. In fact, to say everything is somehow the same, but the approach is a different. Well, the less gossip, and now it going to the subject.

Speaking of the background, it was only the background color and color images, the two I think we must all know where to join bgcolor = "# 808080" and background = "URL" on it, but I would like to introduce here is not to do so but to do with the CSS style, and although some trouble, but still very good overall match.

* Background color of the background-color
I think that I would not do more, introduced, the color code I think we all know, not to replace English with the specified code is expressed. The default value is transparent (transparent color).
Cases: body (background-color: yellow)
H1 (background-color: # 000000)

* Background-image background image
Background image and background color settings in the HTML which is basically the same, can join the relevant statements in the years to complete. But here, I am not talking this way, I use the method or CSS. background-image that the main function is to display pictures, display pictures, if needed, then simply adding url (image address) on it, does not show Well, it is the simplest, and nothing not on the line, because the default is none, but to increase it, is followed by the none on it.
Cases: body (background-image: url (''file &:/// C: / WINDOWS / BACKGRND.GIF''))
h1 (background-image: url (''none''))

We use in the background picture, must often encounter some pictures too small, and have all kinds such as pictures of the repeated and destroyed the beauty of the whole page, would like to change other image problems and improper situation like it. But we are, we just use the following CSS in control of several image methods, then after you no longer have such trouble happened.

* Picture is repeated background-repeat
Sometimes it is necessary to repeat the show, but sometimes repeat the show is annoying, and now this could very well help you, and it can help you control the image to repeat the way (repeat horizontally, vertically, and repeat Repeat both directions), but to achieve these three directions also repeated as long as bcackground-repeat followed by repeat-x (horizontal spread), repeat-y (vertical spread), repeat (2 directions spread). Of course, it can control the repetition of images, you can also control the picture is not repeated. no-repeat that this is only used to display a background image, rather than recurring, yo this is not the default, the default background image is repeated (repeat).
Cases: body (background-image: url (''file &:/// C: / WINDOWS / BACKGRND.GIF''); background-repeat: no-repeat)

* Positioning image display position background-position
A background image after the above settings are not enough, because when you use the above does not repeat the display settings, the picture only shows the top left corner of the page, but not in other places, but if you want to rest in the middle or This background picture appears, then the background-position that can help you, because it is used to display a picture relative to the upper left corner position (default value is 0% 0%), the two values to set determined a space to separate the middle. Some of its main value has left | center | right and top | center | bottom, you can specify a percentage value or a value relative position to specify the absolute position, such as 50% said the location is in the center, and 50px of level value of said image from the upper left corner of the regional level mobile unit 50px; here must point out that one time when you set the value of only one value, equivalent to only specify the horizontal position, vertical is automatically set to 50%; 2 when You set the time value is negative, then the background image beyond the boundary.
Cases: body (background-image: url (''file &:/// C: / WINDOWS / BACKGRND.GIF''); background-repeat: no-repeat; background-position: 100px 10px)

* Control the picture is rolling background-attachment
The above two steps can help you complete the image of the location, but it is not perfect after doing a good job, because if your page has a scroll bar, then you will not always be this background image positioning in that position, if want to locate in that position forever pictures, only for the content of this picture as the page scroll and scroll, then background-attachment can help you if you join the scroll (static) and fixed (scroll) in which 1 on it. Of course not let you add random, after all, scroll is the default, which is not to picture the content with the page scrolling.
Cases: body (background-image: url (''file &:/// C: / WINDOWS / BACKGRND.GIF''); background-repeat: no-repeat; background-attachment: fixed)

Well, after more than Zhe Fan settings, I believe that your background will be more beautiful, but too often the code readability is poor, people get an error, so I have to tell you is that can All together the above code to use, that is added to the above background in the relevant code. Add the code in the background of the time to add in the middle of each value separated by a space, but not to the background color of the background image of the URL code on the back, so that pictures not show up.
Cases: body (background: green url (''file &:/// C: / WINDOWS / BACKGRND.GIF'') fixed 100px 50px no-repeat)

Finally to remind you that if using the code directly into the case, then we must put this code below and then placed in between the normal to show up!