How Css Sprite realizes image flattening technology

Source: Internet
Author: User
This article to you to share is about CSS sprite how to achieve image flattening technology, the content is very good, there is a need for friends to refer to, hope can help everyone.

One, the sprite diagram usage scene:


Second, Css Sprite (merit)

    1. Reduce the byte of the picture.

    2. Reduce Web page HTTP requests, which greatly improve the performance of the page.

    3. Solve the web designer in the image naming problems, just a set of pictures named on it, do not need to name every small element, thus improving the production efficiency of the page.

    4. Changing style is convenient, just need to change the color or style of the picture on one or fewer pictures, the whole page style can be changed. More convenient to maintain.

Three, the realization principle

CSS Background-position

Controls the area range size that a layer can display,
Slide the background image through a window
Instance:

The code is as follows:

<!doctype html>

**background-position:npx npx;
(The first value is the left and right, when you need to turn the background map to a positive value, negative to the left to the same time the background map is transferred up and down with a negative value, the next is positive)**
<2> as follows:
(This is the original)

(This is the image after the election)

The first picture is the conversion of the original image and the Dark One, the lock of the second picture, the train of the four picture, and the villain of the figure.

Related Article

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.