Integrate all background images into one image to reduce the number of image server requests

Source: Internet
Author: User

It seems that this method is becoming more and more popular now. In the past, everyone cut the background into a single small image and use the background to define them one by one. In this way, when the page is opened, each small image will also be loaded, however, in this way, all small images are concentrated in one graph. when defining the background, the coordinates are used for positioning, and the height and width restrictions are combined to achieve the same effect. The benefits are: although the total number of K downloads does not change significantly, the number of image requests is significantly reduced.

Let's just look at it.CodeRight:

<Style type = "text/CSS">
. Bg1 {Background: url(bg_v.png) No-repeat 0 0; padding-left: 20px ;}
. Bg2 {Background: url(bg_v.png) No-repeat 0-20px; padding-left: 20px ;}
. Bg3 {Background: url(bg_v.png) No-repeat 0-40px; padding-left: 20px ;}
. Bg4 {Background: url(bg_v.png) No-repeat 0-60px; padding-left: 20px ;}
. Bg5 {Background: url(bg_v.png) No-repeat 0-80px; padding-left: 20px ;}
</Style>
<A href = "#" class = "Bg1"> Bg1 </a>
<A href = "#" class = "bg2"> bg2 </a>
<A href = "#" class = "bg3"> bg3 </a>
<A href = "#" class = "bg4"> bg4 </a>
<A href = "#" class = "bg5"> bg5 </a>
<Br/>

 

:< br>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.