I want to add a right side border to all div elements except for the last one in each row, where the number of columns in the row varies based on the bootstrap grid system and device.
The row could have 4, 3, 2, or 1 column.
If there are 4 columns, only the first 3 should have a right border. If there are 3 columns, only the first 2 should have a right border. and so on.
rg-product-container {
border-bottom: 1px solid #eee;
min-height: auto;
padding: 30px;
}
.rg-product-container:nth-child(1n+1) {
border-right: 1px solid #eee;
}
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 rg-product-container">STUFF HERE</div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 rg-product-container">STUFF HERE</div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 rg-product-container">STUFF HERE</div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 rg-product-container">STUFF HERE</div>
<!-- ... More dynamically generated HTML -->
</div>
To demonstrate what I mean, I've created this photo. The CSS code above produces a result similar to the image below. My goal is to remove the red border shown in the photo, which varies based on the bootstrap grid configuration.