html - 表格的内边框在 Internet Explorer 9 (IE 9) 中不会拉伸(stretch)整个表格

标签 html css angularjs internet-explorer html-table

我正在使用 Angular Responsive Table我的表的插件。最初,它不能在 IE 9 上运行,但多亏了另一个 SO 成员,我能够通过向表的元素添加“float: left”来为 IE 9 修复它。现在,在 IE 9 中,内表边框不会一直延伸,而是在右栏中的文本结束后立即停止。 (在图片中可能很难看到)。

enter image description here

CSS

<!--[if IE]>
<style>
    .table tbody tr td { float: left; }
</style>
<![endif]-->

HTML

<table class="table table-bordered table-striped table-hover" wt-responsive-table>
    <thead>
        <tr>
            <th>Name</th>
            <th>Version</th>
            <th>Language</th>
            <th>Maintainer</th>
            <th>Stars</th>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat="item in ctrl.projects">
            <td>{{item.name}}</td>
            <td>{{item.version}}</td>
            <td>{{item.language}}</td>
            <td>{{item.maintainer}}</td>
            <td>{{item.stars}}</td>
        </tr>
    </tbody>
</table>

Plunker Demo

附带说明一下,有一个 jQuery 插件 ( Tablesaw: Stack only ) 具有类似的功能,而且它似乎可以开箱即用地与 IE 9 一起使用,没有任何问题!

最佳答案

由于 float 元素只会增长到与其内容一样大,因此您需要明确设置宽度以便它们拉伸(stretch),因此如果您像这样更改 CSS,它将起作用。

@media only screen and (max-width : 800px) {
    .table tbody tr td {
        float: left;
        width: 100%;

    }
    .table {
        overflow: hidden;
    }
}

关于html - 表格的内边框在 Internet Explorer 9 (IE 9) 中不会拉伸(stretch)整个表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35975316/

相关文章:

html - 在 MVC 3 中将宽度设置为 Html.BeginForm()

html - 将搜索栏移动到 Bootstrap 3 中的特定位置

javascript - 如何在单击按钮时在 Angular .js 中动态添加行?

javascript - flex 元素是否有可能与它们上方的元素紧密对齐?

javascript - 引用错误: angular is not defined

javascript - Angular ui网格错误: not found: . ui-grid-header-cell .ui-grid-cell-contents

html - 解释为什么 Height=100% 会破坏设计

javascript - HTML 无限平移 Canvas

html - 使容器在包裹时收缩以适合子元素

jquery - ASP.NET、CSS 和 jQuery