父级div无法被子级div撑开解决

只需要在父级div下添加一个<div style="clear:both;"></div>就可以了

eg:

<div style="height:auto;width:auto;border:dashed;border-color:red">
                    <div id="main2" style="width:auto;height:500px;float:left"></div>
                    <div id="table2" style="width:50%;height:100px;border:double;border-color:rebeccapurple;float:right;display:none">
                        <table>
                            <thead>
                                <tr>
                                    <th>项目状态</th>
                                    <th>数量</th>
                                </tr>
                            </thead>
                            <tbody></tbody>
                        </table>
                    </div>
                    <div style="clear:both;"></div>
                </div>

猜你喜欢

转载自blog.csdn.net/touhousonic/article/details/80004006