flex 在 ie11 下面的兼容问题

element-ui-1.4 的 el-menu 组件出现了一个样式兼容的问题

下面是我抽出来的最简单的 html 和 css 还原这个现象

有什么好的方式去解决呢?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>flex</title>
    <style>
        .outer {
            width: 100px;
            position: relative;
        }
        .menu {
            display: flex;
            position: absolute;
            top: 54px;
            left: 0;
            padding: 20px;
            background-color: green
        }
        .col {
            height: 200px;
            background: red;
        }

        .inner {
            width: 100px;
        }

        .yellow {
            background-color: yellow;
        }

        .blue {
            background-color: blue;
        }

    </style>
</head>
<body>
    <div class="outer">
        <div class="menu">
            <div class="col yellow">
                <div class="inner"></div>
            </div>
            <div class="col blue">
                <div class="inner"></div>                
            </div>
        </div>
    </div>
</body>
</html>

ie 下的表现

clipboard.png

chrome 理想表现

clipboard.png

阅读 6.7k
1 个回答

clipboard.png
IE9是不支持flex的
你可以在IE9下直接使用position去实现,把display:flex去掉

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题