CSS horizontal scroll


I’m trying to create a <div> with a series of photos which are horizontally scrollable only.

It should look something like this LINK;

However the above is only achieved by specifying a width for the <div> which contains the photos (so they don’t ‘word-wrap’). If I don’t put a width – it looks like this;LINK

What can I do using CSS to prevent putting in a fixed width as the images may vary.



You can use display:inline-block with white-space:nowrap. Write like this:

.scrolls {
    overflow-x: scroll;
    overflow-y: hidden;
    height: 80px;
.imageDiv img {
    box-shadow: 1px 1px 10px #999;
    margin: 2px;
    max-height: 50px;
    cursor: pointer;
    *display:inline;/* For IE7*/
    *zoom:1;/* For IE7*/

Check this http://jsfiddle.net/YbrX3/

Answered By – sandeep

Answer Checked By – Senaida (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.