Currently my code results in a view that looks like this:
Lessons Start Now!
x
x
x
x
x
x
(where x = image)
I was wondering how I can make it display like this:
Lessons Start Now!
x x x
x x x
Here is my code for the index.html.erb
<h1>Lessons Start Now!</h1>
<% @lessons.each do |lesson| %>
<%= image_tag(lesson.image, :size => "100x50") %><br />
<%= lesson.subject %><br />
<% end %>
<%= link_to 'New Lesson', new_lesson_path %>
The only thing I can think of is writing a for loop that has a count. It will insert the first images into one div class then once the count = 3, it would insert the next 3 into a different div. Maybe something special can be done using ul and li, or perhaps there is a rails way, any help would be appreciated.
You have to use CSS to do what you desire, let’s say this is your template:
And this would be your CSS then: