views:

30

answers:

1

I have an array of images/links that need to be displayed in columns of 8 for however many rows there are, but I can not control this array.

Is it possible to format this using CSS/HTML (or as a last resort Javascript) so that a new row is created after x items is displayed?

+2  A: 

Yes its very possible by using a fix sized container and css float property.

for e.g.

<div style="width:600px;">
      <div style="width:200px;float:left;"  >
          your data here
   </div>
</div>

You can create the similar code using javascript. Iterate throught the inner div container and after the 600px limit it will automatically start a new line.

anand
Remember to pay attention to margins and borders of the inner div and the padding of the containing one.
s.susini
Perfect solution, thank you.
sterling