嵌套表格:1px 边框,带 css
我正在尝试创建一个带有 1px 黑色边框的表格。
我必须在主表中嵌套一个表,并在下一个表与其封闭的 对接处获得“厚”边框。 我只想到处都有 1px 边框。
我实际上有这个:
table.outer{border:1px black solid; border-collapse: collapse;}
td{border:1px black solid; border-collapse: collapse;}
table.nexted{border:1px black solid; border-collapse: collapse;}
I'm trying to create a table with a 1px black border.
I have to nest a table in the main table, and get "thick" borders where the next table butts against its enclosing <td>
. I just want a 1px border everywhere.
I have this, in effect:
table.outer{border:1px black solid; border-collapse: collapse;}
td{border:1px black solid; border-collapse: collapse;}
table.nexted{border:1px black solid; border-collapse: collapse;}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果我理解正确的话,您可以使用 border-left、border-right、border-top 和 border-bottom 来创建您想要的这些“特殊”情况。
例如,在嵌套表格中,您可以设置
在嵌套表格的左侧获得“结果”1 px 边框。
If I understand you correctly, you can use border-left, border-right, border-top and border-bottom to create these "special" cases you want.
For instance, in your nested tables you can set
to get a "resulting" 1 px border in the left side of the nested table.
没有为嵌套表格提供边框样式
give no border style for your nested table
只需将 border 属性放在 td 上即可。 如果你想要一个 1px 的边框,那就可以了; 你不需要把它放在桌子上。
Just put the border attribute on the
td
s. If you want a 1px border throughout, that'll do it; you don't need it on the tables.此页面描述了如何做得很好: http://www.visakopu.net /misc/table-border-css/
发生的情况是单元格上的边框相互碰撞,导致边框看起来比实际边框更厚。 您不使用 border-collapse 属性,而是在表格本身上设置边框,并且仅在顶部和左侧设置边框,并在单元格的下侧和右侧设置边框。
this page describes how to do it pretty well: http://www.visakopu.net/misc/table-border-css/
What's happening is that the borders on the cells are bumping up against each other, causing it to appear that there are thicker borders than there actually are. Instead of using the border-collapse property, you set a border on the table itself, and only on, say, the top and left sides, and you set borders on the lower and right sides for the cells.