[英]how to solve slideshow css problem?
My Css 我的CSS
#container{
display:block;
}
#container ul{
list-style:none;
position:relative;
margin:0px;
padding:0px;
display:block;
}
#container li{
list-style:none;
margin:0px;
padding:0px;
position:absolute;
top:0;
left:0;
}
#container img{
margin:0px;
padding:0px;
}
my HTML 我的HTML
<div id="container">
<ul>
<li><img src="1.jpg" alt="" /></li>
<li><img src="2.jpg" alt="" /></li>
<li><img src="3.jpg" alt="" /></li>
<li><img src="4.jpg" alt="" /></li>
</ul>
</div>
all the pictures rendered under each other which is what I want but the problem is that if I add any div after #container it will inserted behind it, I want to insert some divs after it but every time I add another div it goes behind it, how can i solve that? 所有要在彼此下渲染的图片都是我想要的,但是问题是,如果我在#container之后添加任何div,它将插入它的后面,我想在它后面插入一些div,但是每次添加另一个div时,它都会在它后面,我该如何解决?
Thanks 谢谢
You can fix this by setting the height and width on #container ul
. 您可以通过在
#container ul
上设置高度和宽度来解决此问题。 That is what I've done when making a photo rotator, since the image sizes are usually known ahead of time. 这是我制作照片旋转器时所做的事情,因为通常会提前知道图像大小。
you need to clearfix the div you insert after container : 您需要清除在container之后插入的div的fixfix:
<div id="container">
</div>
<div id="mydiv" class="clearfix">
</div>
and CSS: 和CSS:
.clearfix {
clear:both;
display:block;
}
Change the style for #container_li to (ie remove the absolute positioning). 将#container_li的样式更改为(即,删除绝对位置)。
#container li
{
display: block;
list-style: none;
margin: -4px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
Maybe you should also alter #container ul to (remove relative positioning) 也许您还应该将#container ul更改为(删除相对位置)
#container ul{
list-style:none;
margin:0px;
padding:0px;
display:block;
}
Offset of -4px
works for IE, -5px
for Firefox. -4px
偏移-4px
适用于IE, -5px
偏移-4px
适用于Firefox。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.