css sprites are CSS Sprites, which is a web image application processing method. CSS sprites have the advantages of reducing the bytes of images, reducing http requests for web pages, improving page performance, and reducing naming difficulties.
CSS Sprites are called CSS sprites or sprites, which are a web image application processing method.
(Learning video sharing:css video tutorial)
CSS Sprites actually integrates some background images on the web page into one image file.
Then use the combination of CSS "background-image", "background-repeat", and "background-position" to position the background. Background-position can accurately position the background image using numbers.
Why is it recommended to use CSS Sprite?
In web page access, the client will send a request to the server every time it needs to access a picture. Therefore, the more pictures are accessed, the more requests are made, and the greater the possibility of delay. .
Therefore, the key to accelerating CSS Sprites technology is not to reduce the quality, but to reduce the number. Of course, the accompanying increase in memory consumption, cumbersome synthesis of CSS Sprites images and other shortcomings will not improve the performance of the website. , it is no longer enough.
Advantages of CSS Sprites:
Reducing the bytes of images
Reduces the http requests for web pages, thus greatly Improved the performance of the page
Reduce the problem of difficult naming
Disadvantages of CSS Sprites:
When merging images , you need to merge multiple pictures into one picture in an orderly and reasonable manner, and leave enough space to prevent unnecessary backgrounds from appearing in the section.
In adaptive pages under widescreen and high-resolution screens, if the picture is not wide enough, it is easy for the background to break.
CSS Sprites are more troublesome to maintain. If there is a slight change in the page background, you usually need to change the merged image. It is best not to change the parts that do not need to be changed, so as to avoid changing more CSS. If It cannot be placed in the original place, and you can only (preferably) add the image down, which will increase the bytes of the image and require changes to the CSS.
Related recommendations:CSS tutorial
The above is the detailed content of What exactly is css sprite map?. For more information, please follow other related articles on the PHP Chinese website!