This is a very simple application, but in the design, this can reduce the pressure on the server, is a good way to reduce the number of requests.
It is particularly worth noting that even two images in this small image can be slow in response time, but there is a problem, that is, when two images are alternating, the background image may be re-loaded, resulting in a period of time not displayed. (The length of time varies depending on the server's response speed and image size)
The following is a part of CSS:
Body {
Font-family: "lucida sans", "lucida sans Unicode ";
Font-size: 14px;
Line-Height: 24px;
}
Ul {
List-style-type: none;
}
Li {
Float: left;
}
A {
Background-image: url(bg.gif );
Height: 26px;
Background-position: 53px 0px;
Display: block;
Margin-Right: 10px;
Width: 53px;
Text-align: center;
Color: #333333;
}
Li A: link {
Text-Decoration: none;
}
Li A: visited {
Text-Decoration: none;
}
Li A: hover {
Text-Decoration: none;
Background-position: 0 0px; // specifies that the image is displayed from a coordinate}
From aboveCodeIt is not hard to see that what plays a decisive role here is
Background-position: ** PX;
In this way, in complex CSS applications, we can solve the problem of reloading background images.