Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/476.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 更改表格列宽_Javascript_Html_Css_Reactjs - Fatal编程技术网

Javascript 更改表格列宽

Javascript 更改表格列宽,javascript,html,css,reactjs,Javascript,Html,Css,Reactjs,我正在使用react库在以下模板中构造表: <div class="table-container" style="width:100%"> <table style="width:100%"> <thead> <tr> <th>BLA_Column</th> </tr> </th

我正在使用react库在以下模板中构造表:

    <div class="table-container" style="width:100%">
    <table style="width:100%">
        <thead>
            <tr>
                <th>BLA_Column</th>
            </tr>
        </thead>
    </table>
    <table style="width:100%">
        <tbody>
            <tr>
                <td>BLA_Body</td>
            </tr>
        </tbody>
    </table>
</div>
另外,当我尝试使用chrome开发工具直接更改宽度时,根本没有任何更改


谢谢你

CSS字符>仅选择直接子项。使用以下内容更改您的CSS:

table > thead th {
    width: 100px;
}


也许您可以考虑将表更改为CSS Flex对象,或者表容器认为您在CSS选择器表中有错误。th不是THADI的直接后代>,我认为问题在于表格宽度:100%-th是显示:表格单元格-将其更改为其他值,如内联块。请参见此处->
table > thead th {
    width: 100px;
}
table > thead > tr > th {
    width: 100px;
}