Internet-the IMG cannot be displayed normally.

Source: Internet
Author: User

I used to display a picture normally in Firefox, but it was very gray in IE. I asked why ie was so spam, and the guy next to me replied:
Because ie wants to provide development opportunities for other browser vendors. The answer is so incisive!

There are various problems that cannot be normally displayed in IE, mainly because we have developed Firefox as a test tool during the development process. We use Firefox as a testing tool because Firefox has powerful debugging functions and is an indispensable tool for developers. In addition, Firefox provides better support for W3C standards, as long as the display in Firefox is normal, other browsers (except IE) are basically normal.

Now, the image cannot be displayed normally. First, let's take a look at my original code: HTML code:
 
 
CSS style sheet:
 .ecmEvaluationStar .startOnClass{ background-image: url("images/star-on.gif"); background-repeat: no-repeat; text-align: center; width: 20px; height: 20px; display: inline-block;}
Here, the Golden Star is normally displayed under Firefox, but cannot be normally displayed under ie. Why? Let's take a look at the IMG Tag defined under W3C standards:

The IMG element embeds an image into the webpage.

Note: Technically, the label does not insert images into the webpage, but links images from the webpage. A tag creates a placeholder space for the referenced image.

A tag has two required attributes: the src attribute and
ALT attribute.

Here, the golden star we show is to display the image by setting the background, rather than embedding the image through the IMG label. In IE, when the parser parses the IMG tag, it will definitely find the src attribute. If this attribute cannot be found, it will parse an exception. Firefox parses the IMG label as a div element if the src attribute cannot be found. In the same code above, the image display is different because the IMG Tag lacks the src attribute and different browser resolution methods are different. If you change the above Code to the following code, this is not the case. <Span Height = "20" width = "20" class = "startoffclass" Title = "$ {resboundle. firstscore} "> </span> edited by the author: Firefox implements a user-friendly design for tag parsing, reducing the possibility of program errors, however, it is easy for beginners to pursue the display of functions, while ignoring the encoding specifications.

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.