vertically I am trying to make a carousel by myself without using any other tools like Bootstrap.
I came across the situation where my images are not aligned horizontally. I tried using display: inline-block
and float: left
separately and desperately, but they didn't seem to be the case of mine. Also, using different techniques dealing with the overflow did not affect the divs either.
So here is my HTML structure:
<div id="image-slider">
<div id="images">
<div class="item"><img src="images/image0.jpg"></div>
<div class="item"><img src="images/image1.jpg"></div>
<div class="item"><img src="images/image2.jpg"></div>
<div class="item"><img src="images/image3.jpg"></div>
<div class="item"><img src="images/image4.jpg"></div>
</div>
<ul id="indicator">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
<input type="button" class="switch" id="prev" value="<">
<input type="button" class="switch" id="next" value=">">
</div>
And here comes the corresponding CSS code:
#image-slider, .item, .item img { /* Tried removing the ".item img" but the images were too big if so */
width: 100%;
height: 100%;
}
#image-slider {
position: relative;
overflow: hidden;
}
#indicator {
position: absolute;
bottom: 0;
}
#images, .item { position: relative; }
.item { display: inline-block; }
So how do I fix it? Oh, another question: how do I modify the #indicator so that the elements inside are clickable elements (without using tools)?