Home >Web Front-end >CSS Tutorial >Why Does `overflow: hidden` Not Work with `position: relative` in IE6 and IE7?

Why Does `overflow: hidden` Not Work with `position: relative` in IE6 and IE7?

DDD
DDDOriginal
2024-11-02 14:06:03464browse

Why Does `overflow: hidden` Not Work with  `position: relative` in IE6 and IE7?

Resolving CSS Issues with Overflow: Hidden and Position: Relative in IE6 and IE7

When encountering CSS issues in Internet Explorer 6 and 7 related to overflow: hidden and position: relative, there is often a specific culprit hindering the intended functionality.

In the provided code snippet, the issue can be attributed to the position: relative property applied to the ul element. While this property is essential for the functionality of the slider, it inadvertently disrupts the overflow: hidden property on the item-list div.

To resolve this, add position: relative to the body element, as seen in the revised code below:

<code class="html"><body>
  <div style="position:relative;">  <!-- New div with position:relative -->
    <div class="column-1">
      <div class="item-list clearfix">
        <!-- Rest of the code remains the same --></code>

This addition creates a new container with position: relative, effectively isolating the ul element's positioning and allowing the overflow: hidden property on the item-list div to work as expected. Consequently, the non-active slides will be successfully hidden.

The above is the detailed content of Why Does `overflow: hidden` Not Work with `position: relative` in IE6 and IE7?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn