creating tables within a for loop -
12-24-2007
, 12:28 PM
I am programming a website in ruby on rails and I am having a problem
aligning tables within a for loop. I have a css element and within
that element a for loop in ruby. The code is as seen below:
<div id="friends">
<table border=1>
<% for user in @users -%>
<td>
<%= link_to
image_tag(user.avatar.public_filename(:tiny)) %>
</td><tr>
<td>
<%= user.screen_name %>
</td></tr>
<% end %>
</table>
</div>
This produces avatar thumbnails with the user screen name below it
which is great, but the cells are lined up wrong. They are lined up
vertically and after each loop it creates a new line so the avatars
are stacked on top of eachother. I want to line these up horizontally
so that I can have rows of avatar links within the css block. Does
anyone know how to do this? Any help is greatly appreciated! I am
totally stuck and have been working on this for days. Thanks. |