[Css] a: hover fails to set the upper and lower borders under ie6 and ie7. hoverie7

Source: Internet
Author: User

[Css] a: hover fails to set the upper and lower borders under ie6 and ie7. hoverie7

I found this problem when writing styles some time ago. Although this bug was solved at that time, I still kept a record to avoid this problem again.

Demo code:

<! Doctype html> 

Through the demo, we can find that in ie6 and ie7 browsers, only the left and right borders are displayed when the mouse moves up and down borders, while other browsers are normally displayed. Why?

Because the hasLayout attribute of a label in ie6 and ie7 is false, What Is hasLayout? I will not talk about Baidu here.

Now that we know the problem is hasLayout, we only need to set hasLayout. There are many methods to set it. Below are two common methods:

a:hover{position:relative;}a:hover{zoom:1;}

PS:

In ie, 80% of bugs are caused by the absence of hasLayout in the element. If you encounter an undefinable problem in ie, the first thing to do is to add hasLayout to the element.

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.