CSS 带有表格,空行没有边框
我在我的项目中使用 Vaadin,目前我遇到了问题。这是 CSS/HTML 问题,我不知道如何解决它......
所以情况看起来像这样:
我有 HTML 结构(自定义布局),看起来像这样:
<table>
<tr>
<td location="loc11"></td>
<td location="loc12"></td>
</tr>
<tr>
<td location="loc21"></td>
<td location="loc22"></td>
</tr>
(...)
</table>
我正在将数据插入到 td 中,位置= “xxx”,数据是在某些位置而不是每个位置。 CSS 看起来像这样:
table.metric_table_layout tr td {
border-bottom: 1px dotted grey !important;
}
这就是问题:
如果 td 为空,则我的边框完全正确毁了我的布局。 有人可以给我一些 CSS(也适用于 IE 7+)来解决这个问题吗? 我不想使用 JS,所以我不确定是否可以仅使用 CSS 来处理这个问题?
谢谢 齐姆
I use Vaadin in my project, currently i'm having a problem with it. It's CSS/HTML problem and i'm not aware how can i fix it...
So the situation looks like that:
I've got HTML structure (CustomLayout) which looks like that:
<table>
<tr>
<td location="loc11"></td>
<td location="loc12"></td>
</tr>
<tr>
<td location="loc21"></td>
<td location="loc22"></td>
</tr>
(...)
</table>
I'm inserting data into td with location="xxx", the data is in some locations not everyone. CSS looks like that:
table.metric_table_layout tr td {
border-bottom: 1px dotted grey !important;
}
And here's the problem:
If the td is empty, i have borders that completly ruined my layout.
Could someone give me some CSS (that will works also in IE 7+) to fix this ?
I don't want to use JS, so i'm not sure if i can handle this with only CSS?
Thx
tzim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试添加:
但在 IE8 中必须有一个
!DOCTYPE
定义。Try to add:
But in IE8 there has to be a
!DOCTYPE
definition.仅通过 CSS,您可以使用
empty-cells:hide
属性。它在浏览器中存在错误,因此需要进行一些预览(在 IEtester 的 IE7 中渲染正常 - 我只需将边框定义为 #ccc 而不是灰色)示例:http://jsfiddle.net/EbvXQ/11/
With CSS only you can use the
empty-cells:hide
property. It's buggy across browsers so do some previews in all (rendered ok in my IE7 from IEtester - I just had to define the border as #ccc instead of gray)Sample: http://jsfiddle.net/EbvXQ/11/