I am working with a list of 8 results that I display in a responsive bootstrap grid. However, I want to only show the results that fill up entire rows.
For instance, on a medium-sized screen, it appears as 2 rows with 4 results each. On a smaller screen, it should display as 2 rows with 2 results in each row and the last row with 2 results only. I only want the first two complete rows to be visible.
Is there a way to instruct Bootstrap not to display the incomplete last row?
let frag = '';
for (let i = 0; i < 8; i++) {
frag += `
<div class="myElem">
<div class="content">
<p>Lorem ipsum...</p>
</div>
</div>
`
}
$("#myDiv").html(frag);
.myElem {
position: relative;
width: 200px !important;
margin-bottom: 1rem;
}
.content {
width: 100%;
height: 100%;
background-color: yellow;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="13717c7c67606761726353263d233d21">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row myDiv" id="myDiv">
</div>