Set body {overflow: hidden;} failure bug in IE6 and IE7

Source: Internet
Author: User

This article Reprinted from: http://www.cnblogs.com/tom-zhu/archive/2012/07/15/2592379.html

 

Set body {overflow: hidden;} failure bug in IE6 and IE7 This is actually not a bug, but it is caused by the default payment of different browsers. Other wise browsers are fine. This bug only appears under IE6 IE7.

 

Problem reproduction:
 
<P> there are no scrollbars on this page in sane browsers </P> HTML, body, P {margin: 0; padding: 0 ;}body {overflow: hidden ;} P {width: 5000px; Height: 5000px ;}

IE6 IE7 does not take effect (the horizontal vertical scroll bars under IE6 are still in the vertical scroll bars under IE7)

Cause:

The smart browser (ex. Chrome and Firefox) will initially pay the value to HTML {overflow: visible ;}

IE6 initial paymentHTML {overflow-X: auto; overflow-Y: Scroll ;}

IE7 initial paymentHTML {overflow-X: visible; overflow-Y: Scroll ;}

The browser will apply the overflow value in the body element to the view area only when HTML {overflow: visible;} is set for the DOM root node (that is, the HTML root node.

For example:

If the body {overflow: hidden} is set, a scroll bar will appear. However, this scroll bar is not the body, but html
Only HTML {overflow: visible;} body {overflow value} can be passed to HTML {}.
In this way, the HTML value becomes {overflow: hidden}, and OK has no scroll bar.

It is clear that it is not a bug, but a problem caused by different browser initial values.

Solution:
 
HTML, body, P {margin: 0; padding: 0 ;}html {Overflow: visible;} Body {overflow: hidden;} p {width: 5000px; Height: 5000px ;}

 

This is actually not a bug, but it is caused by the default payment of different browsers. Other wise browsers are fine. This bug only appears under IE6 IE7.

 

Problem reproduction:
 
<P> there are no scrollbars on this page in sane browsers </P> HTML, body, P {margin: 0; padding: 0 ;}body {overflow: hidden ;} P {width: 5000px; Height: 5000px ;}

IE6 IE7 does not take effect (the horizontal vertical scroll bars under IE6 are still in the vertical scroll bars under IE7)

Cause:

The smart browser (ex. Chrome and Firefox) will initially pay the value to HTML {overflow: visible ;}

IE6 initial paymentHTML {overflow-X: auto; overflow-Y: Scroll ;}

IE7 initial paymentHTML {overflow-X: visible; overflow-Y: Scroll ;}

The browser will apply the overflow value in the body element to the view area only when HTML {overflow: visible;} is set for the DOM root node (that is, the HTML root node.

For example:

If the body {overflow: hidden} is set, a scroll bar will appear. However, this scroll bar is not the body, but html
Only HTML {overflow: visible;} body {overflow value} can be passed to HTML {}.
In this way, the HTML value becomes {overflow: hidden}, and OK has no scroll bar.

It is clear that it is not a bug, but a problem caused by different browser initial values.

Solution:
 
HTML, body, P {margin: 0; padding: 0 ;}html {Overflow: visible;} Body {overflow: hidden;} p {width: 5000px; Height: 5000px ;}

 

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.