【发布时间】:2011-07-06 14:49:51
【问题描述】:
我希望表格的标题单元格具有特定的边框颜色和渐变填充。我希望它看起来像这样:
这是上面的html:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<table>
<thead>
<tr>
<th>Column00</th>
<th>Column01</th>
<th>Column02</th>
</tr>
</thead>
<tbody>
<tr>
<td>Feline</td>
<td>Cat</td>
<td>Felidae</td>
</tr>
<tr>
<td>Canine</td>
<td>Dog</td>
<td>Caninae</td>
</tr>
<tr>
<td>Primate</td>
<td>Ape</td>
<td>Primates</td>
</tr>
</tbody>
</table>
</body>
</html>
这是css:
table{
border-collapse: collapse;
}
th{
border: 3px #449944 solid;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#44bb44'); /* IE */
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#44bb44)); /* Chrome */
background: -moz-linear-gradient(top, rgba(255,255,255,1), rgba(85,205,85, 1));
}
它在 Chrome 12 和 Firefox 5 中完美显示,但在 IE 9 中看起来像这样:
看起来 IE9 将渐变填充放在边框顶部。如何让 IE9 “在顶部”显示 TH 元素的边框?
TIA。
【问题讨论】:
-
可能是边框折叠问题。试试
th{ border-collapse: no-collapse; -
完全正确 - 但还必须设置 TH 元素的边框
-
@Kyle Sevenoaks:尝试了您的建议,但似乎没有任何影响......
-
@user639175: “...但是 TH 元素的边框也必须设置”。我已经设置了 TH 元素的边框宽度、颜色和样式。我应该设置其他属性吗?
-
@couche:你关心的只有IE9吗? IE8 或更低版本重要吗?
标签: html css internet-explorer-9 border gradient