首页 > 解决方案 > 应用溢出时div不会扩展到全宽:自动

问题描述

[在此处输入图片描述][1]目前我面临一个问题。我使用带有修复标题和滚动条到 div 行部分的 div 生成表。但问题是两个 div 都没有占据整个 50% 50% 的宽度。

我试过以下代码。但没有工作。

.brd2 {
        height: auto;
        max-height: 100px;
        overflow: auto;
        position: absolute;
        width: 100%;
    }

    .back-clr {
        background-color: red;

    }
    HTML PART
     <div class="container">
    <div class="row">
        <div class="col-md-8">
            <div style="display: table;width:100%">
                <div style="display: table-row">
                    <div style="width:50%; display: table-cell;">
                        Test
                    </div>
                    <div style="width:50%; display: table-cell;">
                        test
                    </div>
                </div>
                <div class="brd2" style="display: table-row;">
                    <div class="content" style="width:50%; display: table-cell;">
                        <p>sdfds
                            fdsf</p>
                        <p>dsfds
                            fds</p>
                        <p> fds
                            fsf
                            dsf</p>
                        <p>sdfds
                            fdsf</p>
                        <p>dsfds
                            fds</p>
                        <p> fds
                            fsf
                            dsf</p>
                    </div>

                    <div class="content back-clr" style="width:50%;display: table-cell;">
                        this is second div
                    </div>
                </div>
            </div>


        </div>
    </div>
</div>

标签: htmlcsswidth

解决方案


推荐阅读