I have a problem using bootstrap 4 (specifically, reactstrap but I can recreate the same issue in bootstrap) where I am using 'card-columns' to create a grid of cards, each card having a dropdown menu in the 'card-footer'. The problem is that once I have 4 or more cards the dropdown appears to break across columns somehow....where it is rendered is different to where chrome highlights the element, as shown by this image:
If I increase my card count, then on some cards when I open the dropdown, the card will change position - they 'jump around'.
Minimal example:
body {
margin: 10px;
}
.dropdown-menu {
margin-top: 10px;
margin-bottom: 10px;
}
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="container-fluid h-100">
<div class="mx-4 my-2 row">
<div class="mx-4 row">
<div class="card-columns">
<div class="card border-secondary">
<div class="card-footer">
<div class="row">
<div class="col-md-8">
<div class="btn-group show">
<button class="dropdown-toggle btn btn-outline-secondary">
More
</button>
</div>
</div>
</div>
</div>
</div>
<div class="card border-secondary">
<div class="card-footer">
<div class="row">
<div class="col-md-8">
<div class="btn-group show">
<button class="dropdown-toggle btn btn-outline-secondary">
More
</button>
</div>
</div>
</div>
</div>
</div>
<div class="card border-secondary">
<div class="card-footer">
<div class="row">
<div class="col-md-8">
<div class="btn-group show">
<button class="dropdown-toggle btn btn-outline-secondary">
More
</button>
</div>
</div>
</div>
</div>
</div>
<div class="card border-secondary">
<div class="card-footer">
<div class="row">
<div class="col-md-8">
<div class="btn-group show">
<button class="dropdown-toggle btn btn-outline-secondary">
More
</button>
<div role="menu" class="dropdown-menu show" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 27px, 0px);" data-placement="bottom-start">
<button class="dropdown-item">
Button 1
</button>
<button class="dropdown-item">
Button 2
</button>
<button class="dropdown-item">
Button 3
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card border-secondary">
<div class="card-footer">
<div class="row">
<div class="col-md-8">
<div class="btn-group show">
<button class="dropdown-toggle btn btn-outline-secondary">
More
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
In this example, only the last 2 buttons of the menu seem to 'break' and appear elsewhere - your screen needs to be wide enough to show more than 1 column for the problem to occur.
I imagine the problem is to do with the dropdown extending beyond the cards' boundaries when opened, even though it is absolutely positioned.
How can I make such a dropdown without it interfering with the card-columns layout?