I have a div with several child divs which are floating left. I don't want them to break, so I set them to display:inline-block
and white-space:nowrap
. Unfortunately nothing happens at all. They just keep breaking.
At the end I want to scroll in x-direction, but when I add overflow-x:scroll; overflow-y:visible
it scrolls in y-direction.
.a {
width: 400px;
height: 300px;
white-space: nowrap;
display: inline-block;
}
.b {
float: left;
width: 50px;
height: 200px;
display: inline-block;
}
<div class="a">
<div class="b"></div>
<div class="b"></div>
<div class="b"></div>
<div class="clearfix"></div>
</div>
You can see my complete implementation on JSFiddle
I may not fully understand your question but it seems like the divs/scroll behave if you remove:
float: left;
from.b
and add:overflow:auto;
to.a
Not sure what you mean, but if you stop floading your b, and give your a overflow:auto it should work
see: /jsfiddle.net/88yjz/3/
Does this give you what you want? Added overflow scroll.