Reputation: 3103
<div style='float:left; width:300px; overflow:hidden;'>
<div style='float:left; width:100px; '>1</div>
<div style='float:left; width:100px; '>2</div>
<div style='float:left; width:100px; '>3</div>
<div style='float:left; width:100px; '>4</div>
</div>
I need to display 'div' inline another 'div'. I have some difficulties with css style display:inline-block. Outer 'div' should have some width. div inside have to display inline. In example last 'div' should be invisible, but stay inline with other.
Upvotes: 2
Views: 7199
Reputation: 3103
<style>
ul#display-inline-block-example,
ul#display-inline-block-example li {
/* Setting a common base */
margin: 0px;
padding:0px;
}
ul#display-inline-block-example li {
display: inline-block;
min-height: 100px;
background: #ccc;
}
</style>
<div style='width: 200px; overflow:hidden;'>
<ul id="display-inline-block-example" style='width:350px; height:100px;'>
<li><div style='width:100px;'>1</div></li>
<li><div style='width:100px;'>2</div></li>
<li><div style='width:100px;'>3</div></li>
</ul>
</div>
Upvotes: 0
Reputation: 2729
Use this CSS on your wrapper div
.container{
overflow: auto;
white-space:nowrap;
}
& take out float
and use inline-block
instead.
div{
display: inline-block;
}
Now you have an inline horizontal scroll!
Upvotes: 2