css - 表格元素在 Internet Explorer 中没有很好地对齐

标签 css internet-explorer bootstrap-4

列表元素在 Internet Explorer 中未居中。但在 Chrome 中,元素是居中的。附件是示例代码。我正在为所有类使用 Bootstrap CSS Framework

这是 JSfiddle https://jsfiddle.net/8cunpsvy/

the result in IE

the result in Chrome

HTML:

<div class="card-body">
    <table class="table-sm table-hover">
        <thead>
            <tr class="text-center">
                <th class="w-25" scope="col"></th>
                <th style="width: 54%" scope="col"></th>
                <th style="width: 10%" scope="col">Actual</th>
                <th style="width: 1%;" scope="col">Status</th>
                <th style="width: 10%" scope="col">Expected</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td></td>
                <td></td>
                <td class="text-center">2/13/2019</td>
                <td class="text-center">
                    <ul class="status-circle"><li></li></ul>
                </td>
                <td class="text-center"></td>
            </tr>
        </tbody>
    </table>
</div>

CSS:

.status-circle {
    list-style: none;
    margin: 0;
    padding-inline-start: 0;
    margin-block-start: 0;
    margin-block-end: 0;
    border-spacing: 0px;
    line-height: 0;
}

.status-circle li {
    display: inline-block;
    border-radius: 50%;
    border: 1px solid #000;
    width: 15px;
    height: 15px;
    background: #737373;
}

最佳答案

我已将里面的元素更改为 div,并从 li 元素转移了所有样式并添加了内容。

HTML:

<div class="card-body">
    <table class="table-sm table-hover">
        <thead>
            <tr class="text-center">
                <th class="w-25" scope="col"></th>
                <th style="width: 54%" scope="col"></th>
                <th style="width: 10%" scope="col">Actual</th>
                <th style="width: 1%;" scope="col">Status</th>
                <th style="width: 10%" scope="col">Expected</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td></td>
                <td></td>
                <td class="text-center">2/13/2019</td>
                <td class="text-center">
                    <div class="div-status-circle"></div>
                </td>
                <td class="text-center"></td>
            </tr>
        </tbody>
    </table>
</div>

CSS:

.div-status-circle {
    display: inline-block;
    border-radius: 50%;
    border: 1px solid #000;
    width: 15px;
    height: 15px;
    content: "";
    background: #737373;
}

关于css - 表格元素在 Internet Explorer 中没有很好地对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54822224/

相关文章:

html - 在其他 HTML 标签中使用 "link_to"

css - Angular Material 输入并在一个表单字段中选择

html - CSS - 将 body 标签内的所有内容居中

css - 在 Bootstrap 中将 `.img-responsive` 置于 `.container-fluid` 和 `row` 的中心?

php - 当我将所有图像设置为 col-6 时,为什么我的图像会位于彼此下方?

css - 侧边栏中的 Div 未按预期 float

html - 语义 UI CSS 右填充

c - 在 C# 中设置 Internet Explorer/Windows 使用 Socks5 代理

HTML5 自适应宽度视频使父容器高度在 IE11 中扩展

angular - 如何将图标添加到 ngx-bootstrap Accordion 组标题中?