Posted By

Tate on 07/23/09


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

webstic
davidsi


Adjust the size of an image based on the amount of images in a row


 / Published in: Rails
 

1115px is the width of the containing ul, 206px x 109px is the size of the original images

  1. <% if @players.size > 10 %>
  2. <style type="text/css">
  3. #player_list li img { width: <%= 1115 / @players.size %>px; height: <%= ((206/109.to_f) * (1115 / @players.size)).to_i %>px; }
  4. </style>
  5. <% end %>

Report this snippet  

You need to login to post a comment.