Sorry for posting this here, maybe it's not the most appropriate place for such questions, but I've posted the same on several different technical forums, and got no help... and I need to solve this problem somehow... *headdesk*
I have a gallery page, with number of items on it. Each item is a thumbnail image + short title, all wrapped in a DIV element with fixed width/height. How should I make browsers wrap all those items list into several rows, if the width of the page is unknown? On 800x600 resolution there should be, say, 8 items per row, on 1024x768 there should be 10 etc.
So far I did this: <div style="float:left"> for each item. This wraps them correctly (see below), but all items are aligned to the left now, and there is an unpleasant gap on the right. And all items should be centered. Here's the example:
<style>
div { border:1px solid black; }
div.pic { float:left; width:100px; height:100px; margin:5px; }
</style>
<div style="width:380px;height:250px">
<!-- 1st "picture" -->
<div class="pic" style="background-color:green"></div>
<!-- 2nd "picture" -->
<div class="pic" style="background-color:red"></div>
<!-- 3rd "picture" -->
<div class="pic" style="background-color:blue"></div>
<!-- 4th "picture" -->
<div class="pic" style="background-color:yellow"></div>
</div>
It shows the following:

But what I need is the following:

Or:

Need help...
