i Have a flexbox with three containers on the top text line of a card. I can't get the middle item to center (evenly centered down the center line of the extents of the card).
Here's a picture of what I'm getting:
Here is the flexbox section of the css (with some commented out previous attempts I keep tinkering with)
.review-card-flex {
display: flex;
// justify-items: center;
justify-content: center;
// justify-content: space-between;
// align-content: center;
// flex-wrap: wrap;
& > .review-box1 { // avatar
order: 1;
justify-self: flex-start;
flex-basis: auto;
margin-right: auto;
}
& > .review-box2 { // product info
order: 2;
flex-basis: auto;
justify-self: center;
// margin: 0px auto;
}
& > .review-box3 { //date
order: 3;
justify-self: flex-end;
flex-basis: auto;
margin-left: auto;
}
}
Here is the HTML (its a ruby-rails view erb)
<h1 class="centered-header">Our Reviews</h1>
<div class="reviews-container">
<% if @reviews.any? %>
<div class="reviews-ul">
<% @reviews.each do |review| %>
<div class="review-card">
<div class="review-card-flex">
<div class="review-box1">
<% _user = @users.find_by(id: review.user_id) %>
<% if _user.avatar_pic.attached? %>
<%= image_tag _user.avatar_pic, class:"avatar-tiny", alt: 'User Avatar' %>
<% else %>
<%= image_tag 'generc_profile_pic.webp', class:"avatar-tiny", alt: 'Avatar Not Found ' %>
<% end %>
<%= link_to review.author, review_path(id: review, product_id: review.product_id) %>
</div>
<div class="review-box2">
<% _product = @products.find_by(id: review.product_id) %>
<%= link_to _product.name, product_path(_product) %>
<%= ' from ' %>
<%= _product.country %>
</div>
<div class="review-box3">
<p>On <%= review.created_at.strftime('%m-%d-%Y') %></p>
</div>
</div>
<div class="review-stars">
<div class="stars" style="--rating: <%= review.rating %>;" aria-label="Rating of this review is " <%= review.rating %> " out of 5."></div>
</div>
<div class="review-index-text">
<%= review.content_body %>
<div></div>
<% if _product.product_photo.attached? %>
<%= image_tag _product.product_photo, class:"product-image-tiny", alt: 'Product Image' %>
<% else %>
<%= image_tag 'image_not_available.webp', class:"card-image-not-found", alt: 'Image Not Found' %>
<% end %>
</div>
</div>
<% end %>
</div>
<% else %>
<p>There are no reviews yet.</p>
<% end %>
</div>
<div class="pagination">
<%= will_paginate @reviews%>
</div>