The solution of font-size:0 invalid under IE6/7

Source: Internet
Author: User

Now Ie6/7 browser font-size:0 and text is not 0, the page runs when the text of the caption becomes a small black dot.


IE6 The default font size is roughly between 12-14px, and when you try to define a DIV that is less than this default value, IE6 will be adamant that the height of the layer should not be less than the row height of the font. So even if you use height:5px; To define the height of a DIV, the actual display under IE6 is still a layer of 12px or so high

Solution One


To resolve this problem, you can enforce the font size of the div, or define the overflow property to restrict the automatic adjustment of the div height. Like what:

The code is as follows Copy Code

<div style= "HEIGHT:5PX; font:0px Arial; line-height:0; " ></div>

Or

<div style= "HEIGHT:5PX; Overflow:hidden; " ></div>

It's worth noting that setting font-size:0 When the height of this container is minimum 2px, if you want to set the DIV height to 0 or 1px, you need to use Overflow:hidden; To achieve.

Solution Two:

1, set line-height:0;

2,text-indent:-9999em

Summarize

Use the line-height:0 to solve the Ie6/7 browser small black point problem, also can use the second method text-indent:-9999em to solve the small black spot problem.

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.