My query revolves around filling the contents of two columns with different heights within a row. Although the columns themselves are of equal height, the cards inside them are not.
+---------------------------+---------------------------+
| +-----------------------+ | +-----------------------+ |
| | | | | | |
| | | | | | |
| | | | | | |
| +-----------------------+ | | | |
| | | | |
| | | | |
| | | | |
| | +-----------------------+ |
+---------------------------+---------------------------+
Adding the .h-100
class to the first card results in it losing its bottom margin, causing misalignment with the other one. Applying h-100
to both cards ensures they have the same height but sacrifices the bottom margin on both. Is there a correct approach to achieving full height for the cards in each column?
https://jsfiddle.net/yjfzvpoh/1/
Review this code snippet:
<style>
.card {
position: relative;
margin-bottom: 1.5rem;
width: 100%;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="690b06061d1a1d1b0819295c4758475a">[email protected]</a>/dist/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="791b16160d0a0d0b1809394c5748574a">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-md-6">
<div class="card h-100">
<div class="card-body">
<div class="row">
<div class="personal-information mt-30">
<div class="name-text">
<h6 class="font-14"><span class="text-muted">Trabajador :</span> Ninguno asociado</h6>
<h6 class="font-14"><span class="text-muted">E-mail :</span> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="85eff6f1f0e4f7e1eac5e1e0f6fcf1e0e6abe6eae8">[email protected]</a></h6>
<h6 class="font-14"><span class="text-muted">Teléfono :</span> </h6>
<h6 class="font-14"><span class="text-muted">Cliente :</span> Ninguno asignado</h6>
<h6 class="font-14"><span class="text-muted">Empresas :</span> Ninguna asignada</h6>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6">
...
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-body">
This is another card
</div>
</div>
</div>
</div>
Would it be viable to make the left div
match the height of the right div
? Essentially, both div
elements should have the same inner height as the one belonging to the row
class.