The difference between a CSS background map and HTML insert img

Source: Internet
Author: User
1. The images written in CSS are in the form of a background image, while the HTML is written in
Label form exists, in the process of Web page loading, the image that exists in the CSS background image will wait until the structure loading is complete (after the content of the page is all displayed), and the HTML
A label is a part of the structure (content) of the page that is loaded during the loading of the structure. In other words, the page will load first
The contents of the tag, and then load the background image, if you use
Introduced a large picture, then before the download of this picture is complete,
The content will not be displayed later. And if you use CSS to introduce the same image, the structure of the Web page and the content is loaded, the background image will not be loaded, and it won't affect the content of your Web browsing.
2. Usually non-content of the picture is written in the CSS, if the content of the picture is written in the HTML,
For example, you want to make a photo album with a nice border. Then the frame of the picture is written in the CSS, the picture frame inside the content is written in the HTML.
Web page Design direction is the presentation layer and Content layer separation, CSS tube performance, that is, display effect, HTML tube structure, content structure division, so that the code is simple and easy to maintain some.

3. The browser reads the page, the CSS background image and the IMG image are downloaded to the local cache folder. As for how long the cache is, each cache file has a tag, and the browser will determine whether to resend the request to the server for resources. As for how this tag is, it depends on how the server is set up. As a result, CSS backgrounds and img Images can be reused in Web pages.
4. Picture as the background, when the picture is not loaded or failed to load, there will not be a picture of the placeholder tag, will not appear red fork.


Sina Bo Friends

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.