Background-image "CSS sprites,base64 encoding" in CSS

Source: Internet
Author: User

In CSS, background can set the object's background style. such as color or use a picture instead, today I would like to say two more words is to use the parameters of a picture: image. To be precise, it should be background-image. We can use it this way:

body{
Background-image:url (...) JPG);

}
/* You can also use background instead of */

body{
Background:url (".... jpg");

}

CSS display of 3 kinds of pictures, the first is a simple display of a picture, the second is called CSS Sprites, that is, a number of small images to synthesize a large picture, and then through the background postion parameters to achieve the effect, the third is Inline images. This method does not apply to IE browsers.

CSS sprites is a kind of all the pictures are Base64 encoded in the form of source code written in the CSS file, the format is this:data:[<mediatype>][;base64],<data>

The Data:url tag was first presented in 1995, as described by the RFC2397 specification: It is "allows inclusion of small data items as ' immediate ' data. (Allow some small, real-time information to be included in the page)". such as an inline image can be referred to as:

{  background-image:url(data:image/gif; Base64,r0lgodlhcaaiajeaaonp6etk5o7m8aaaach5baeaaaialaaaaaaiaagaaainjamjh2q6dnxovsqmlqa7) ;  }
 

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.