I am making auto-carousel, but li
floating doesn't work. Why does the list stretch horizontally? If I set display: block;
or overflow: hidden;
to ul
, it just cuts the bottom part and does not float the list.
HTML and CSS
ul.slide-wrap {
position: relative;
width: 600%;
height: 100%;
overflow: hidden;
margin: 0;
padding: 0;
list-style: none;
}
.slide-box {
position: absolute;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
}
li.slide-item {
width: 100%;
height: 100%;
float: left;
}
<div class="slide-box">
<ul class="slide-wrap">
<li class="slide-item">1</li>
<li class="slide-item">2</li>
<li class="slide-item">3</li>
<li class="slide-item">4</li>
<li class="slide-item">5</li>
</ul>
</div>