Home  >  Article  >  Web Front-end  >  What is CSS sprite

What is CSS sprite

hzc
hzcOriginal
2020-06-24 15:12:193835browse

CSS Sprites is called css sprites by many people in China. It is a web image application processing method. It allows all sporadic images involved in a page to be included into one large image. In this way, when When accessing this page, the loaded images will no longer be displayed one by one as before.

What is CSS sprite

1. CSSSprites are called css sprites by many people in China. They are a web image application processing method. It allows you to include all the scattered pictures involved in a page into one big picture, so that when the page is accessed, the loaded pictures will not be displayed one by one as before. . I have given a concept diagram below for you to refer to. In the final analysis, it is to stuff many small pictures into one big picture through some means. The advantage of this is that it only needs to be loaded once when loading the web page - the big picture we mentioned above.

2. Method: Use background-position in css, which is an attribute in css. It means adjusting the position of the background image in the css box.

3. Code example: .d1{background-position:0px 0px;}

This code means The position of the background image with the ID name test1 is the 0 position of the coordinate origin, which is the default position

d2{background-position:50px 50px;}

This code This means that the position of the background image with the ID name test2 is 50 pixels above, below, left, and right of the origin (default position).

4. For explanations of codes and attributes, please refer to the "css manual".

What is CSS sprite

Recommended tutorial: "HTML Tutorial"

The above is the detailed content of What is CSS sprite. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn