html - Chrome/IE 和 Edge 之间的 CSS flex 显示区别?

标签 html css flexbox

我有一个如下所示的 html 片段。在 Chrome 和 IE 上,垂直滚动条显示在 divSub2 内部,但在 Edge 中,divSub2 上的垂直滚动条不显示,而是显示在 body 上。我怎样才能让它在 Edge 上运行,比如在 Chrome 或 IE 上?

<html>
<head>
    <style type="text/css">
        body,html{
            height:100%;
            width:100%;
            padding:0;
            margin:0;
        }
        body{
            display:flex;
            flex-flow:column;
        }
        .divTop{
            height:100px;
            width:100%;
        }
        .divBottom {
            height: 100px;
            width: 100%;
        }
        .divMain{
            width:100%;
            flex:1;
            background-color:lightblue;

            display:flex;
            flex-flow:column;
        }
        .divSub1{
            height:40px;
            width:100%;
        }
        .divSub2{
            flex:1;
            overflow-y:auto;
            height:100%;
            background-color:aqua;
        }
    </style>
</head>
<body>
    <div class="divTop">
    </div>
    <div class="divMain">
        <div class="divSub1">
        </div>
        <div class="divSub2">
            <p>Text</p>
            <p>Text</p>
            <p>Text</p>
            <p>Text</p>
            <p>Text</p>
            <p>Text</p>
            <p>Text</p>
            <p>Text</p>
            <p>Text</p>
            <p>Text</p>
            <p>Text</p>
        </div>
    </div>
    <div class="divBottom">
    </div>
</body>
</html>

截图: The vertical scrollbar displayed on body, in Edge

最佳答案

在 divSub2 上添加属性 height:0;

关于html - Chrome/IE 和 Edge 之间的 CSS flex 显示区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43568372/

相关文章:

php - Joomla 到静态 HTML 网站

Javascript expandme 图片点击

html - Firefox 不尊重可见性 :hidden on table header

PHP MVC 不同的样式表,每个页面上的 javascript 文件

html - Flexbox 包裹在容器外面

html - 圆 Angular 不适用于 div 中的所有 Angular ?

php - 带有 PHP 代码的元素显示错误

javascript - `i` 在 `.each(function (i) {})` 中的作用是什么?

css - 显示 flex 。如何让第二个元素显示在第一个元素下方。

css - 隐藏 Flexbox 溢出