Ok so I thought I had this fixed using white-space:no-wrap it worked in chrome but nothing else.
I have something like this:
<div class="outer">
<ul>
<li>
<div class="inner">
<a href="#"><img src="eg1.jpg" /></a>
<br />
EG1 lorem ipsum
</div>
</li>
<li>
<div class="inner">
<a href="#"><img src="eg2.jpg" /></a>
<br />
EG2 lorem ipsum
</div>
</li>
.
.
.
//etc (multiple li's)
</ul>
</div>
excuse the really poor image but this is the efect im aiming for.
I want a single row of 'items' if they exceed the space then horizontal scroll bars should appear.
hope that makes sense, how can i achieve this?
Set the overflow-y: hidden; and overflow-x: auto; that will automatically hide the vertical scroll bar and present only the horizontal scrollbar. The white-space: nowrap; property is used to wrap text in a single line. Here the scroll div will be horizontally scrollable.
It can be done by the following approach: Approach: Making all the div element in inline using display: inline-block; property. Adding the scroll bar to all the div element using overflow-x: auto; property.
To enable horizontal scrolling, we can use the CSS property overflow-x. If we assign the value scroll to the overflow-x property of the container element, the browser will hide horizontally overflowing content and make it accessible via horizontal scrolling.
((JavascriptExecutor) driver). executeScript("arguments[0]. scrollIntoView(true);", element); This works for vertical scrolling but not for horizontal.
Write like this:
.outer{
width:400px;
overflow:auto;
white-space:nowrap;
}
.outer li{
display: inline-block;
*display: inline;/*For IE7*/
*zoom:1;/*For IE7*/
vertical-align:top;
width:40px;
margin-right:20px;
background:red;
white-space:normal;
}
Check this http://jsfiddle.net/ZrpHv/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With