Is there a way to center the checkbox input both vertically and horizontally within its parent column?
The image below illustrates the parent column and checkbox. I have attempted using classes like text-centered
, d-flex justify-content-center
, and align-self-center
, but none have been successful. Could it be related to nested columns?
https://i.sstatic.net/itVsy.png
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c6a4a9a9b2b5b2b4a7b686f3e8f4e8f6eba4a3b2a7f7">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
<div class="container-lg">
<div class="row">
<div class="col-2">
<div class="row align-items-center h-100">
<div class="col-4 d-flex border justify-content-center align-items-center h-100">
<div class="form-check align-items-center d-flex justify-content-center align-items-center">
<input class="form-check-input" type="checkbox" value="{{obj.total}}" id="flexCheckDefault" checked> <!-- CENTER THIS ITEM -->
</div>
</div>
<div class="col-4 d-flex justify-content-center h-100 border">
<div class="form-check d-flex justify-content-center align-items-center">
<input class="form-check-input" type="checkbox" value="{{obj.total}}" id="flexCheckDefault" checked> <!-- CENTER THIS ITEM -->
</div>
</div>
<div class="col-4 h-100 border d-flex align-items-center justify-content-center">
<div class="form-check d-flex justify-content-center align-items-center">
<input class="form-check-input" type="checkbox" value="{{obj.total}}" id="flexCheckDefault" checked> <!-- CENTER THIS ITEM -->
</div>
</div>
</div>
</div>
<div class="col-10">
<div class="row align-items-center h-100">
<div class="col-2 h-100 border d-flex align-items-center justify-content-center">
<span>Name</span>
</div>
<div class="col-8 h-100 border d-flex align-items-center">
<span>Desc</span>
</div>
<div class="col-1 h-100 border d-flex align-items-center">
<span>Total</span>
</div>
<div class="col-1 wg-right-bottom-border h-100">
<div class="form-check d-flex justify-content-center">
<input class="form-check-input align-self-center" type="checkbox" value="{{obj.total}}" id="flexCheckDefault">
</div>
</div>
</div>
</div>
</div>
</div>
Extra credit for maintaining both vertical and horizontal alignment when printing.