Overflow in CSS: The solution cannot be hidden if hidden is invalid in ie6 or ie7.

Source: Internet
Author: User
Tags relative

This is the bug of ie6 and ie7.

Solution:

When the style of the parent or child element has the position: relative attribute, the overflow: hidden attribute of the parent element becomes invalid.
In IE 6 7, we found that the child element will exceed the height set by the parent element, even if the parent element is configured with overflow: hidden.

It is easy to solve this bug. You can use position: relative; in the parent element to solve this bug.

Example

The code is as follows: Copy code

<Style type = "text/css">
. Parent {width: 100px; height: 100px; position: absolute; border: 1px solid # f00 ;}
. Son {width: 100px; height: 100px; left: 0; top: 0; overflow: hidden; position: relative ;}
P {margin: 0; padding: 0 ;}
</Style>
<Div class = "parent">
<Div class = "son">
<P> aaaaaaaaaaaa </p>
<P> aaaaaaaaaaaa </p>
<P> aaaaaaaaaaaa </p>
<P> aaaaaaaaaaaa </p>
<P> aaaaaaaaaaaa </p>
<P> aaaaaaaaaaaa </p>
<P> aaaaaaaaaaaa </p>
<P> aaaaaaaaaaaa </p>
</Div>
</Div>

The solution is to set absolute positioning for the child element and relative positioning for the parent element, so that overflow: hidden will not be invalidated.

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.