CSS tutorial: a detailed explanation of the location of a background picture
problems in learning can be posted to the forum communication!
we often find a situation when we study the styles of other web sites, in which the same picture is called in many background attributes to meet the use of various parts of the web. Open this picture and see that this picture contains a lot of small pictures, such as
These small pictures are all parts of the whole picture, put each part on one picture, instead of storing them separately, the purpose of which we all know is to reduce the number of HTTP requests and save time and bandwidth.
how to implement a picture in a different place only to show a part of it, which uses the location of the background picture we want to say today. This question believes that many people are depressed and often have friends to ask me, so today, the system says:
we know that when using the picture as the background, CSS should write this, for example, div container, also can be body, TD, P and other background, the same reason.
[code]div{background:#FFF URL (image) no-repeat fixed x y;}[/code]
the background attribute values here are: (color values, places where background images are not covered, or background colors without background images) < (here is a picture). Address) whether
no-repeat repeats: (a picture is less than a container's big hour, the default will be repeated to fill the container, no-repeat does not repeat, only at this time the rear location coordinates are useful.) Whether the
fixed background is scrolling with the container: (there are two optional values, scroll rolling, fixed non scrolling, the default is scroll)
x y background image location: (note, it is meaningful only to locate under no-repeat. This is the focus of the day.