I've encountered similar queries before, but the responses provided were not quite what I needed. While one answer came close to my desired outcome, it led to other complications that I am now facing. My main challenge is maintaining consistent vertical divider heights within columns of varying element counts.
https://i.sstatic.net/onL9E.png
HTML
<nav id="subCategories" class="row navbar bg-light">
<div class="col-lg-3 col-4" style="border-right: 1px solid grey">
<h6>BIKES</h6>
<li class="nav-link subCategory">FULL SUSPENSION</li>
<li class="nav-link subCategory">HARDTAIL</li>
<li class="nav-link subCategory">E-BIKES</li>
...
</div>
<div class="col-lg-3 col-4" style="border-right: 1px solid grey">
<h6>EQUIPMENT</h6>
<li class="nav-link subCategory">HELMETS</li>
<li class="nav-link subCategory">PROTECTORS</li>
<li class="nav-link subCategory">GLOVES</li>
<li class="nav-link subCategory">JERSEYS</li>
<li class="nav-link subCategory">PANTS</li>
...
</div>
<div class="col-lg-3 col-4" style="border-right: 1px solid grey">
<h6>PARTS</h6>
<li class="nav-link subCategory">GPS</li>
<li class="nav-link subCategory">LIGHTS</li>
...
</div>
<div class="col-lg-3 col-4">
<h6>FOR THE BIKE</h6>
<li class="nav-link subCategory">SCOOTER PARTS</li>
<li class="nav-link subCategory">BMX PARTS</li>
<li class="nav-link subCategory">TYRES/TUBES</li>
<li class="nav-link subCategory">CHAINS</li>
</div>
</nav>
CSS
.subCategory {
border-right: 1px solid grey;
}
#subCategories {
align-items: flex-start;
}
The most effective CSS approach I found was:
.subCategory {
border-right: 1px solid grey;
display: table-cell;
}
#subCategories {
align-items: flex-start;
display: table;
}
https://i.sstatic.net/sWC4u.png
subCategory {
border-right: 1px solid grey;
}
#subCategories {
align-items: flex-start;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
<nav id="subCategories" class="row navbar bg-light">
<div class="col-lg-3 col-4" style="border-right: 1px solid grey">
<h6>BIKES</h6>
<li class="nav-link subCategory">FULL SUSPENSION</li>
<li class="nav-link subCategory">HARDTAIL</li>
<li class="nav-link subCategory">E-BIKES</li>
...
</div>
<div class="col-lg-3 col-4" style="border-right: 1px solid grey">
<h6>EQUIPMENT</h6>
<li class="nav-link subCategory">HELMETS</li>
<li class="nav-link subCategory">PROTECTORS</li>
<li class="nav-link subCategory">GLOVES</li>
<li class="nav-link subCategory">JERSEYS</li>
<li class="nav-link subCategory">PANTS</li>
...
</div>
<div class="col-lg-3 col-4" style="border-right: 1px solid grey">
<h6>PARTS</h6>
<li class="nav-link subCategory">GPS</li>
<li class="nav-link subCategory">LIGHTS</li>
...
</div>
<div class="col-lg-3 col-4">
<h6>FOR THE BIKE</h6>
<li class="nav-link subCategory">SCOOTER PARTS</li>
<li class="nav-link subCategory">BMX PARTS</li>
<li class="nav-link subCategory">TYRES/TUBES</li>
<li class="nav-link subCategory">CHAINS</li>
</div>
</nav>