Separating posts in a newsfeed using CSS/BootStrap
<p>I'm currently trying to render a newsfeed, similar to that of FB on a Rails application I'm working on. Unfortunately, I'm not the greatest when it comes to CSS and I'm having some issues trying to display different posts. This issue occurs whether I'm using BootStrap or plain CSS. I do believe it's something to do with the loop that is created by <code>&lt;% @posts.each do |post| %&gt;</code> Currently, whenever a new post is made, it wraps inside the previous post; thus the more posts that are made, the thicker the border gets. </p>

<p>Image: <img src="https://s30.postimg.org/jqkjna7zl/Screen_Shot_2016_12_09_at_13_58_12.png" alt="Newsfeed"></p>

<pre><code>&lt;% if @posts.any? %&gt;
&lt;% @posts.each do |post| %&gt;
&lt;div class="well"&gt;
  &lt;a href="/users/&lt;%= post.user.id %&gt;/show"&gt;&lt;%= post.user.first_name %&gt; &lt;%= post.user.last_name %&gt;&lt;/a&gt;&lt;br&gt;
  &lt;% if !post.image.exists? %&gt;
    &lt;h2&gt; &lt;%= post.text %&gt; &lt;/h2&gt;
  &lt;% else %&gt;
    &lt;h2&gt; &lt;%= link_to post.text, post_path(post) %&gt; &lt;/h2&gt;
    &lt;%= link_to post_path(post) do %&gt;
      &lt;p&gt;&lt;%= image_tag post.image.url(:medium) %&gt;&lt;/p&gt;
    &lt;% end %&gt;
  &lt;% end %&gt;
&lt;% if @user %&gt;
    &lt;% if current_user.voted_up_on?(post) %&gt;
      &lt;%= link_to "Like", dislike_post_path(post), method: :put %&gt;
    &lt;% else %&gt;
      &lt;%= link_to "Like", like_post_path(post), method: :put %&gt;
    &lt;% end %&gt;
&lt;% end %&gt;
&lt;%= "Likes: #{post.get_upvotes.size}" %&gt;
&lt;% if post.user == current_user %&gt;
&lt;%= link_to "Edit", edit_post_path(post) %&gt;
&lt;%= link_to "Delete", post_path(post), method: :delete %&gt;
&lt;% end %&gt;
&lt;div id='comments_div' class="comments-index"&gt;
  &lt;%= render post.comments %&gt;
&lt;/div&gt;
&lt;% if current_user %&gt;
  &lt;%= form_for [post, post.comments.new ], remote: true do |f| %&gt;
   &lt;%= f.text_area :text, placeholder: 'Add a comment' %&gt;
   &lt;%= f.submit 'Comment' %&gt;
  &lt;% end %&gt;
&lt;% else%&gt;
  &lt;p&gt;You need to &lt;%= link_to "sign in", new_user_session_path %&gt; to comment&lt;/p&gt;
&lt;% end %&gt;
&lt;% end %&gt;
&lt;% else %&gt;
No posts have been added!
&lt;% end %&gt;
&lt;/div&gt;
</code></pre>

<p>Any help would be greatly appreciated! Thanks. </p>

<p>Edit: OK, please take a look at the new image -- hopefully that will make the issue slightly more obvious. Additionally, I've removed all the dead tags and replaced them with just one: BootStrap's 'well' class. So, there you have it. All the information you need is within the code above.</p>