div不占高度

时间:2019-05-09 13:44:22

标签: html css layout

设置div高度时出现问题。我需要设置100%,但结果如下: enter image description here

这是我的代码:

 <body>

<div class="container-scroller">
    <nav class="navbar default-layout p-0 fixed-top d-flex flex-row" style="height: 63px;">
        <select id="region" onchange="initProcess();" style="position:absolute;background:#eaeaea;">
        </select>
        <div style="width: calc(100% - 74px); padding-left: 74px; left: 0; text-align: center; color: #fff">
            <img src="images/co-logo.png" style="width: 100px; margin-top: -6px">
            <h4>Dashboards</h4>
        </div>
        <div class="navbar-menu-wrapper d-flex align-items-right">
            <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-right" type="button" data-toggle="offcanvas">
                <span class="mdi mdi-menu"></span>
            </button>
        </div>
    </nav>

    <div style="border: 1px solid black;" id="main" class="page-body-wrapper divfull">
        <div class="div1">1</div>
        <div class="div2">2</div>
    </div>
</div>

</body>

那是我的CSS。我需要将两个div都设置为100%

.div1 {
        border: 1px solid black;
        width: 50%;
        height: 100%;
        background-color: blue;
        float: left;
    }
    .div2 {
        border: 1px solid black;
        width: 50%;
        height: 100%;
        background-color: blue;
        float:right;
    }

有帮助吗?谢谢!

0 个答案:

没有答案