I’m trying to do an iphone style swipey thing on my webpage. The idea is that in my sidebar, if I click a link it will side the sidebar to the left to reveal where that link would go to. To do this, I am creating two sidebars side by side, the visible sidebar and the next sidebar that will be hidden behind another element.
An example of the sidebars can be found at http://jsfiddle.net/gpcC6/7/
The problem I’m having, is when the window is resized, the second sidebar goes under the first. I want to to stay to the right, even if it means that it goes off the side of the screen. Is this possible?
Thanks
Put the sidebars in a container that has
white-space: nowrapand make themdisplay: inline-blockinstead of floating them and it should work as per your instructions.Note that
white-space: nowrapin some browsers will interpret the space between two divs in the HTML as an actual spaceTo remove that spacing you need to place them on the same line
Alternatively, you can add a
font: 0;to the parent element, in this case the container that will remove the spacing as well, but beware that you need to explicitly define the font size for all elements before you do that, otherwise all the child elements will have a font size of 0 as well. 😉See this question and this article for more information.
Sample | Code
CSS
HTML