【发布时间】:2015-08-20 17:00:17
【问题描述】:
我有一个动态创建的大型 HTML 表格。
该表具有标准结构,包括。 colgroup、thead 和 tbody 以及以下样式。
到目前为止,一切都按预期工作,但是当我将“bgGrey”类添加到一列中的 TD 时(见下文),以便为该列中的单元格提供背景颜色(仅在一列上需要)然后此列的所有边框在 IE11 中都消失了,除了左边框,并且 :hover::before 样式在 Chrome 中不再起作用(版本 43)。
如果不添加 "bgGrey" 类,我在两个浏览器中都没有问题。
似乎背景颜色与边框重叠导致了这种情况。
我的 CSS(相关部分):
#myTable, #myTable tbody, #myTable thead, #myTable tr {
width: 100%;
}
#myTable, #myTable th, #myTable td {
border: 1px solid #000;
border-collapse: collapse;
margin: 0;
padding: 4px;
position: relative;
}
#myTable {
font-size: 14px;
table-layout: fixed;
}
#myTable th.editable:hover::before, #myTable td.editable:hover::before {
border: 1px solid blue;
content: '';
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
z-index: -1;
}
#myTable .th1 {
padding: 2px;
}
#myTable .th2 {
font-weight: normal;
}
.bgGrey {
background-color: #e6e6e6;
}
我的 HTML(示例 TR):
<tr>
// ...
<td class="editable"><div contenteditable="true"></div></td>
<td class="bgGrey editable txtCenter"><div contenteditable="true"></div></td>
<td class="editable txtRight"><div contenteditable="true"></div></td>
// ...
</tr>
【问题讨论】:
标签: css border background-color border-color