CSS CSS Sprites (CSS Wizard) technology

Source: Internet
Author: User

 CSS Sprites

CSS sprites in the domestic many people called the CSS Wizard, is a Web page image application processing way. It allows you to include all the scattered images of a page in a large image, so that when you visit the page, the loaded picture will not be shown as a picture of the past. For the current popularity of the network speed, no more than 200KB of a single picture of the required loading time is basically the same, so there is no need to worry about this problem.

CSS sprites is actually to integrate some of the background image into a picture file, and then use the CSS "Background-image", "Background-repeat", "Background-position" The combination of the background positioning, background-position can be used to pinpoint the position of the background image.in Web Access, the client sends a request to the server for each image that needs to be accessed, so the more images you have, the more requests you have, and the more likely you are to delay. Therefore, CSS sprites technology to accelerate the key, not to reduce the quality, but to reduce the number, of course, with the increase in memory consumption, CSS sprites pictures cumbersome synthesis and other shortcomings in the performance of the site before the upgrade, is not enough for the road.    use of CSS sprites:. Bg_sprite{background-image:url (/full map address); Background-repeat:no-repeat}#ico1 {width: container width; height: container height; background-position:x coordinate y-coordinate}#ico2 {width: container width; height: container altitude; background-position:x coordinate y-coordinate} #ico3 {width: container width; height: container heights; BACKGROUND-POSITION:X coordinates Y coordinate}. nav {width: container width; height: container height; background-position:x coordinate y-coordinate} Of course there are shorthand methods: #ico1 {width: container width; height: container height; background:u  RL (/Full image address) no-repeat x coordinate y-coordinate;} where the x and y coordinates represent the offset of the original image relative to the upper-left corner of the Ico1 box, that is, the coordinates 0 0 indicate that the upper-left corner of the background and Ico1 box coincide.    Example:Image "Bg_sprite.png" code
1 ico {width:16px;height:16px;background:url ("bg_sprite.png") No-repeat 0-234px;}

The effect is:

  

CSS CSS Sprites (CSS Wizard) technology

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.