View Full Version : horizontal scroll thumbnails

12-04-2009, 11:46 AM
I have image thumbnails pulled out of a database that sits in a div that 300px wide. Each image thumbnail (which sits inside the div) is 53px wide and 40px high. Depending which product is selected by the user the image thumbnails will be displayed in the 300px div.

The problem i have got is when there are say 8 thumbnails to be displayed i still need them to sit in that div but the user can scroll horizontally (left to right) to view the thumbnails.

At the moment another row is inserted underneath the top one which is not quite what i am looking for.

Any ideas on how to accomplish this?

12-04-2009, 02:55 PM
Assuming you are using PHP or some server-side script and assuming you have a <ul> wrapped within a containing, static-width <div> (with overflow-x:scroll;) you can set the width of the <ul> dynamically based on your box model calculations (the sum of an individual thumbnail's width, side border, side padding, and side margin) multiplied by the number of thumbnails returned from the DB.

Other than that, all I can think of is a hacky, non-semantic use of a table.

12-07-2009, 01:16 PM
Hi Guys

Would i use the same approach to achieve this:


This is the end result i would like to get?