[SOLVED] How to align child table td with parent table th

Issue

This Content is from Stack Overflow. Question asked by Aneeq ul Haq

I have two tables parent and child now I want to link the child table data with the parent th. I can’t change the code structure like removing the child table because this is done in Odoo and also js link with this structure. I tried a lot but didn’t achieve the correct output.

The HTML code is

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <style type="text/css">
        
    </style>
</head>
<body>
    <table id="data-lines" class="table ks_table_cj0" style='border-spacing: 0;' 
        cellspacing="0" width="100%">
        <thead class="ks_thead">
            <tr>
                <th colspan="8">Journal (code)</th>
                <th class="">Debit</th>
                <th class="">Credit</th>
                <th class="">Balance</th>
                <th class=""></th>
            </tr>
        </thead>
        <tbody>
            <tr style='background-color:white;color:#4A4F59;padding:20px' 
                class="ks_cj-py-mline" >
                <td colspan="8">
                    <i class="con_folded fa fa-caret-right" role="img" 
                        aria-label="Unfolded" title="Unfolded"/>
                    <i style='display:none' class="con_unfolded fa fa-caret-down" 
                        role="img" aria-label="Unfolded" title="Unfolded">    
                    </i>
                    <span>
                        Account Receivable 124000 
                    </span>
                </td>
                <td class="ks_amt ">
                    <span>$7,270.00</span>
                </td>
                <td class="ks_amt">
                    <span>$7,270.00</span>
                </td>
                <td class="ks_amt">
                    <span>$7,270.00</span>
                </td>
                <td class="ks_amt">
                    
                </td>
            </tr>

            <tr>
                <td colspan="12" class="p-0">
                    <ul class="ks_py-mline-ul">
                      
                    </ul>
                    <div class="ks_py-mline-table-div">
                        <table class="table ks-mline-data-table  display compact">
                            <thead class="ks_thead">
                                <tr>
                                    <th  colspan="12">Account Name</th>
                                    <th class="">Debit</th>
                                    <th class="">Credit</th>
                                    <th  colspan="2" class="">Balance</th>
                                </tr>
                            </thead>
                            <tbody>
                                
                                <tr>
                                    <td  colspan="12">
                                        
                                        <div class="dropdown">
                                            <a data-toggle="dropdown" href="#">
                                                <span t-att-data-move-id="account_line.id">
                                                    <t t-esc="account_line.name"/>
                                                </span>
                                                <i class="fa fa-caret-down" role="img" aria-label="Unfolded"
                                                   title="Unfolded"/>
                                            </a>
                                            
                                            <ul class="dropdown-menu p-2" role="menu">
                                                <li role="presentation">
                                                    <a  class="ks_ks_view-source" tabindex="1" >
                                                        General Ledger
                                                    </a>
                                                </li>
                                            </ul>
                                            
                                        </div>
                                        
                                    </td>

                                    <td t-att-style="style" class="ks_amt">
                                        <span>$7,27</span>
                                    </td>
                                    <td t-att-style="style" class="ks_amt">
                                       <span>$7,2</span>
                                    </td>
                                    <td t-att-style="style" class="ks_amt">
                                        <span>$722</span>
                                    </td>
                                    <td t-att-style="style" class="ks_amt">
                                        <span>$7</span>
                                    </td>
                                </tr>
                                
                            </tbody>
                        </table>
                    </div>
                </td>
            </tr> 
        </tbody>
    </table>
</body>
</html>

The output you can check in this link



Solution

Do you try use for parent element display: flex; align-item: center; justify-content: center? I should help


This Question was asked in StackOverflow by Aneeq ul Haq and Answered by Aeroxer Support It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?