Web Standard: IMG Image shows blank bug solution under IE6

Source: Internet
Author: User

In the div+css layout of the page, encountered IE6 (of course, sometimes Firefox will encounter) in the browser of the picture element img, the problem of extra white space is definitely a common solution to the problem is also "play by ear."

1. Convert a picture to a block-level object

That is, set the IMG to "Display:block;". In this example, add a set of CSS code: "#sub img {display:block;}".

2. Set the vertical alignment of the picture

That is, setting the Vertical-align property of the picture to "Top,text-top,bottom,text-bottom" can also be resolved. In this example, add a set of CSS code: "#sub img {vertical-align:top;}".

3. Set the Parent object's text size to 0px

That is, add a line in #sub: "font-size:0;" can solve the problem. However, this also raises a new issue in which the text in the parent object cannot be displayed. Even if the text part of the quilt object, set the sub-object text size can still be displayed, but in the CSS when the validation will prompt the text too small error.

4. Change the properties of the parent object

If the parent object is wide, high-fixed, and the picture size is determined by the parent object, you can set the Overflow:hidden; To solve. In this example, you can add the following code to #sub: "Width:88px;height:31px;overflow:hidden;".

5. Set the floating properties of the picture

In this case, add a line of CSS code: "#sub img {float:left;}". This approach is a good choice if you want to achieve a picture-and-text mix.

6. Cancels the space between the picture label and the last end tag of its parent object

This method to emphasize, in the actual development of the method may be a mess, because in the code to make the code more semantic and clear, it is unavoidable to provide code indentation through the IDE, which will inevitably let the label and other labels line display, such as DW's "format source" command. So this method can provide us with an understanding of the occurrence of a bug, the specific solution will have to see you recruit.

(China Webmaster Station: http://www.chinaz.com/Webbiz/Exp/0219C4502009.html)

Web Standard: IMG Image shows blank bug solution under IE6

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.