Just started creating a website in WordPress with Bootstrap 4 and I've been puzzling on an issue for days now.
I'm trying to vertically align read more buttons for a 'related posts' section on a website. I want to have the read more button automatically aligned to the longest caption text. I've tried multiple ways with relative/absolute, but I can't seem to get it to work.
Here is my current code:
<div class="row">
<?php $cat = new WP_Query( 'cat=6&posts_per_page=3' ); ?>
<?php while($cat->have_posts()) : $cat->the_post(); ?>
<div class="col-xs-12 col-md-4 readmore">
<img class="w-100" src="<?php the_post_thumbnail_url(); ?>">
<div class="col-12" style="margin-top:15px;">
<h2 class="h6 text-uppercase text-center text-nowrap"><strong><?php the_title(); ?></strong></h2>
<p><?php the_content(); ?></p>
<p><?php //the_excerpt(); ?></p>
</div>
<div class="col-6 mx-auto" style="bottom: 10px;margin-bottom: 20px">
<a href="<?php the_permalink(); ?>" class="d-block btn btn-secondary btn-sm">Read More</a>
</div>
</div>
<?php endwhile; ?>
</div>
<?php wp_reset_postdata(); ?>
And this is how it look currently:
The thing that makes the even more difficult is that ideally it should still be responsive. So on a smaller screen the buttons should be directly after the caption, like this:
Hopefully it's clear what the problem is and hopefully someone can share their thoughts. Thanks in advance!