因此,我为主页创建了一个滑块,使用 jQuery 滑动一些带有标题和预告文本的图像。一切正常,我去检查 IE,发现 IE 6 和 7 完全杀死了我的滑块 css。我不明白为什么,但由于某种原因,我无法使用 Overflow:hidden; 隐藏非活动幻灯片。我尝试来回调整CSS,但无法找出导致问题的原因。
我在一个更独立的 html 页面中重新创建了该问题。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="da" lang="da" dir="ltr">
<head>
<style>
body {
width: 900px;
}
.column-1 {
width: 500px;
float: left;
}
.column-2 {
width: 200px;
float: left;
}
.column-3 {
width: 200px;
float: left;
}
ul {
width: 2000px;
left: -499px;
position: relative;
}
li {
list-style: none;
display: block;
float: left;
}
.item-list {
overflow: hidden;
width: 499px;
}
</style>
</head>
<body>
<div class="column-1">
<div class="item-list clearfix">
<ul>
<li class="first">
<div class="node-slide">
<img src="http://www.hanselman.com/blog/content/binary/lolcats-funny-pictures-leroy-jenkins.jpg" />
<div class="infobox">
<h4>Title 1</h4>
<p>Teaser 1</p>
</div>
</div>
</li>
<li>
<div class="slide">
<img src="http://www.hanselman.com/blog/content/binary/lolcats-funny-pictures-leroy-jenkins.jpg" />
<div class="infobox">
<h4>Title 2</h4>
<p>Teaser 2</p>
</div>
</div>
</li>
<li class="last">
<div class="slide">
<img src="http://www.hanselman.com/blog/content/binary/lolcats-funny-pictures-leroy-jenkins.jpg" />
<div class="infobox">
<h4>Title 3</h4>
<p>Teaser 3</p>
</div>
</div>
</li>
</ul>
</div>
</div>
<div class="column-2">
...
</div>
<div class="column-3">
...
</div>
</body>
</html>
我查到这是
ul {
position: relative;
}
在导致溢出的 ul 元素上:隐藏不起作用,但为什么会这样,我不知道。此外,还需要使用 ul 上的 left 属性来使滑块 javascript 工作来滑动它。任何有关如何解决此问题的想法都是非常受欢迎的。
这是 IE6 和 IE7 中的一个众所周知的错误。要解决这个问题,需要添加相对于容器的position:relative。由于在您的情况下,主体是容器,因此我建议您直接在主体下方添加一个 div 并为其指定位置:相对。它应该可以解决你的问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)