CSS to border <tr> 在 Internet Explorer 中完全不能正常工作

标签 css

我正在使用以下 CSS 为 <tr> 加边框完全。

<style type="text/css">
    tr.top td { border-top: thin solid black; }
    tr.bottom td { border-bottom: thin solid black; }
    tr.row td:first-child { border-left: thin solid black; }
    tr.row td:last-child { border-right: thin solid black; }
</style>

它在 Mozilla Firefox 中完美运行,但在 Internet Explorer 中,它不与最后右边的边界 <td>如以下快照所示。

在 Firefox 中,它显示下表。

enter image description here

但是在 Internet Explorer(8) 中,它显示的表格如下。

enter image description here

表示在上面的CSS中,这个CSS类tr.row td:last-child { border-right: thin solid black; }在 IE 中不起作用。解决这个问题的方法是什么?我正在使用 IE 8。

最佳答案

IE 8 不支持 :last-child 伪类 (CSS 3),但它支持 :first-child (CSS 2.1)

CSS Compatibility and Internet Explorer

最后一个单元格需要一个不同的选择器,例如自定义类名。

关于CSS to border <tr> 在 Internet Explorer 中完全不能正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10111206/

相关文章:

html - 拉伸(stretch)图像

html - 防止为 nopCommerce 缓存 CSS

css - 表行选定的颜色更改 JavaFX

javascript - Mozilla Firefox 问题。 HTML 选择(下拉菜单)某些选项的颜色

jquery - 如何使用 CSS 汉堡菜单上下滑动移动菜单

javascript - 使用 jquery 添加多文本字段

javascript - CSS 和 javascript 中的 (Chromium) alpha 颜色值(在 rgba 中)

javascript - 提交前检查复选框是否被选中

html - anchor 标签不起作用并保持选中状态,直到我再次单击

javascript - Bootstrap 轮播不是全宽