-2

This is my first question.

I have an application using rails and bootstrap. When the screen goes to small, the items around the picture don't respond the same as on a medium & large screen. Take a look:

https://i.stack.imgur.com/x6uBD.jpg - Good size, everything functions well. https://i.stack.imgur.com/yr5Au.jpg - Bootstrap small size (functions badly)

I want the stars and the buttons to be below and within the width of the picture. I thought naturally bootstrap would make the buttons responsive with the picture because all of it is located within the same <div class="col-sm-4 col-md-3">

I'm currently not styling this page so no CSS needs to be added to this question.

I'm using paperclip as my image resizing gem.

<div class="row">
<% @movies.each do |movie| %>
    <div class="col-sm-4 col-md-3">                    
        <div class="thumbnail">
            <% if user_signed_in? %>
                <div class="js-rating" movie_id="<%= movie.id %>" data-rate-value=6></div>
            <% end %>
            <br>
            <%= link_to (image_tag movie.image.url(:medium), class: 'image'), user_movie_path(movie.user, movie) %>
            <% if movie.user == current_user %>
                <br>
                <div class="image-buttons">
                    <%= link_to 'Edit', edit_user_movie_path(movie.user, movie), class: 'btn btn-primary' %>
                    <%= link_to "Remove", user_movie_path(movie.user, movie), method: :delete, data: { confirm: "You Sure?" }, class: 'btn btn-primary btn-remove-main' %>
                </div>
            <% end %>
        </div>
    </div>
<% end %>

1 Answers1

0

Essentially, your question boils down to "How do i make my thumbnail div be only as wide as the image within it?

Using the same technique as in this answer: Make wrapper take maximum width of child image?

.wrapper {
  border: 1px solid red;
  display: inline-table;
  margin-top: 1em;
  width: 1%;
  text-align: left;
}

.col {
  text-align: center;
}
<div class="col">
  <div class="wrapper">
    <div>&#8902; &#8902; &#8902; &#8902; &#8902;</div>
    <img src="http://www.fillmurray.com/284/196">
    <button>My Button</button> <button>My Other Button</button>
  </div>
</div>
Paulie_D
  • 107,962
  • 13
  • 142
  • 161