How can I display elements in a grid view (horizontally, 3-4 elements per row) with adequate spacing between them? I attempted to use margin but it was ineffective.
This is my HTML.erb code:
<h1> Entries </h1>
<table>
<% @listings.each do |listing| %>
<tbody>
<tr>
<th><%= listing.title %></th>
</tr>
<tr>
<td><%= listing.text %></td>
</tr>
<tr>
<td><%= listing.zipcode %>, <%= listing.city %></td>
</tr>
<tr>
<td><%= link_to 'View', listing_path(listing) %></td>
<td><%= link_to 'Edit', edit_listing_path(listing) %></td>
<td><%= link_to 'Delete', listing_path(listing),
method: :delete,
data: { confirm: 'Are you sure?'} %></td>
</tr>
</tbody>
<% end %>
</table>
<%= link_to 'New Entry', new_listing_path %>
This is my CSS file:
...
table {
border-collapse: collapse;
}
tbody {
border: 3px solid #000;
}