I want to build my own carousel for learning purposes. But I'm curious how to do it properly. I tried to put divs as carousel items next to each other with float:left. Every div has a fixed width and height.
After that, I've put a div around the carousel items, called "clipping". The clipping div has the same size as the elements in it that should be moved at a time (if you move 3 elements by clicking "next", the clipping div's width is equal to the width of these 3 elements). I've seen this in a few examples. Also this clipping div gets overflow: hidden to hide the next and previous carousel items.
The problem is that the elements, which should be hidden through the clipping div, are put on a new line which makes the whole thing unusable.
How can I work around this behaviour?
If the question is not clear enough, tell me, I will try to rewrite it.