I have a nested table which should take up the entire width of the cell in which it is expanding. Currently, it is leaving some margins which I have tried to reduce but what I did is not working. I have tried other solutions previously answered to similar questions but nothing is working.
$(function(){ $(".fold-table tr.view").on("click", function(){ $(this).toggleClass("open").next(".fold").toggleClass("open"); }); }); .table{ font-size:12px; width: 50%; border-collapse: separate; border-spacing: 0 2px; } table thead th{ border-bottom: 0px; } table td,th{ border-top: 0px; } th{ background-color:#FFFF } .main tr:nth-child(odd){ background-color: #F8F8F8 } .tbody tr:nth-child(even){ background-color:#F8F8F8 } table.fold-table > tbody > tr.view td, table.fold-table > tbody > tr.view th { cursor: pointer; } table.fold-table > tbody > tr.view:hover { background: #ddd; } table.fold-table > tbody > tr.view.open { background: #ddd; } table.fold-table > tbody > tr.fold { display: none; } table.fold-table > tbody > tr.fold.open { display: table-row; } .span{ width: 100% !important; } .fold-content > table { width: 100%; } table.fold-content > tr{ background-color:#ddd !important; } <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" /> <table class="table fold-table" id="table"> <thead> <tr> <th scope="col">Name</th> <th scope="col">Email</th> <th scope="col">Contact Details</th> </tr> </thead> <tbody> <tr class="view main"> <td >John</td> <td >[email protected]</td> <td >35373726</td> </tr> <tr class="fold"> <td colspan="3 span"> <div class="fold-content"> <table> <tbody> <tr class="view"> <td >John</td> <td >[email protected]</td> <td >35373726</td> </tr> <tr class="view"> <td >John</td> <td >[email protected]</td> <td >35373726</td> </tr> <tr class="view"> <td >John</td> <td >[email protected]</td> <td >35373726</td> </tr> </tbody> </table> </div> </td> </tr> <tr> <td >John</td> <td >[email protected]</td> <td >35373726</td> </tr> <tr> <td >John</td> <td >[email protected]</td> <td >35373726</td> </tr> <tr> <td >John</td> <td >[email protected]</td> <td >35373726</td> </tr> </tbody> </table> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="table.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script> Please suggest how I can deal with this scenario.
Thanks as always !

