首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Flexbox问题出现在IE11上的表格上

Flexbox问题出现在IE11上的表格上
EN

Stack Overflow用户
提问于 2018-07-12 09:50:05
回答 0查看 69关注 0票数 0

我在IE11上遇到了一个基于flexbox的表格的问题。下面是它在其他浏览器中的外观:

这是它在IE11上的样子:

请参阅代码:

代码语言:javascript
复制
<div class="submasthead__items">
    <table class="submasthead-item__table">
        <thead>
        <tr>
            <th>Qualifying deposits of:</th>
            <th>Eligible for a bonus of:</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>
                $20,000 - $49,999
            </td>
            <td class="text--brightRed">
                $200
            </td>
        </tr>
        <tr>
            <td>
                $50,000 - $99,999
            </td>
            <td class="text--brightRed">
                $300
            </td>
        </tr>
        <tr>
            <td>
                $100,000+
            </td>
            <td class="text--brightRed">
                $500
            </td>
        </tr>
        </tbody>
    </table>
</div>

以下是我使用flexbox的SCSS部分:

代码语言:javascript
复制
&__items {
    .submasthead--SM1 & {
        margin: 2em 0;
        @include respond-to($medium) {
            margin: 1.3em 0;
            display: flex;
            justify-content: space-around;
        }
    }
}

&__subcopy {
    max-width: 925px;
    margin: 0 auto;
    .submasthead--SM1 & {
        @include respond-to($medium) {
            max-width: none;
            margin: 0;
            display: flex;
            justify-content: center;
        }
    }
    p {
        font-size: $copy-small;
        width: 95%;
        @include respond-to($medium) {
            width: 45%;
        }
    }
}


&-item {
    &__table {
        border-collapse: collapse;
        width: 98%;
        @include respond-to($medium) {
            width: 400px;
            max-width: 100%;
            min-width: 300px;
        }
        td {
            .submasthead--SM1 & {
                flex: 1;
                text-align: left;

                @include respond-to($medium) {
                    text-align: center;
                }
            }
        }
        th {
            padding: 0.4em 0.5em;
            font-size: $copy-small;
            line-height: 1.25;
            .submasthead--SM1 & {
                text-align: left;
                flex: 1;

                @include respond-to($medium) {
                    text-align: center;
                    font-size: $copy-regular;
                }
            }
        }
        tr {
            border: 1px $color-coolGrayLight solid;

            .submasthead--SM1 & {
                display: flex;
                td + td {
                    text-align: center;
                    font-weight: bold;
                }

                *:nth-child(1) {
                    flex-basis: 20%;

                    @include respond-to($medium) {
                        flex-basis: 0;
                    }
                }

                @include respond-to($medium) {
                    align-items: center;
                }
            }
        }
        tbody {
            tr:nth-child(odd) {
                background-color: $color-coolGrayLight;
            }
        }
    }
}

我创建了一个codepen,以防您想看一下:https://codepen.io/anon/pen/pZvXoJ

请参阅此代码,以防其他代码不起作用:https://codepen.io/maketroli/pen/pZvXoJ

你知道我的代码可能出了什么问题吗?

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51296284

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档