Bernardo C. Bernardo C. - 3 months ago 13
CSS Question

IE and Edge height 100% bug

I'm trying to make my div

main.wrapper
fit the viewport height, with overflow. It is working on Safari and Google Chrome, but when opened and resized to a smaller height using IE or Edge, becomes a bug.

Is there a way to fix this and prevent the right content to exceed the 100% height? Does Bootstrap has this functionality, and it will be easier if used?

The problem (IE and Edge)

JSFiddle

Answer

How about using flexbox instead?

html, body, .app, .left-pane, .right-pane {
    width: 100%;
    height: 100%;
}

.row, .col {
    margin: 0 !important;
    padding: 0 !important;
}

.left-pane {
    background: green;
    display: flex;
    flex-direction: column;
}

.right-pane {
    background: pink;
    display: flex;
    flex-direction: column;
}

.right-pane main {
    flex: 1;
    overflow-y: auto;
}

.right-pane main .wrapper {
    height: 100%;
}

.right-pane main .wrapper {
    overflow: auto;
}

header {
    flex: 0 1 50px;
    max-height: 50px;
    background: blue;
}

footer {
    flex: 0 1 50px;
    max-height: 50px;
    background: yellow;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css" rel="stylesheet"/>
<div class="row app">
    <div class="col s4 left-pane">
        <header>header left</header>
        body left
    </div>
    <div class="col s8 right-pane">
        <header>header right</header>
        <main>
            <div class="wrapper">
                <p>main</p>
                <p>main 2</p>
                <p>main 3</p>
                <p>main 4</p>
                <p>main 5</p>
                <p>main 6</p>
                <p>main 7</p>
                <p>main 8</p>
                <p>main 9</p>
                <p>main 10</p>
            </div>
        </main>
        <footer>footer</footer>
    </div>
</div>

Comments