Html <table style="border-collapse:collapse"> 部分右边框被切断(附截图)的问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9576226/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Issue with <table style="border-collapse:collapse"> Part of right border is cut off (screenshots attached)
提问by Newbie Aspiring Programmer
I'm a new web developer (obviously). When I first noticed this issue, I thought it might be something quirky with the site I was working on. Since then I've worked on several other sites and noticed the same thing.
我是一名新的网络开发人员(显然)。当我第一次注意到这个问题时,我认为这可能是我正在处理的网站有些奇怪。从那以后,我在其他几个网站上工作并注意到了同样的事情。
When I use the CSS property "border-collapse:collapse" to stylize HTML tables, sometimes the far-right border gets cut off when I load the page (both in FF and IE). Strangely enough, when I scroll up and down it occasionally fixes itself without reloading the page. It usually happens toward the bottom-right corner of the table, as the second screenshot indicates.
当我使用 CSS 属性“border-collapse:collapse”来风格化 HTML 表格时,有时当我加载页面(在 FF 和 IE 中)时,最右侧的边框会被切断。奇怪的是,当我上下滚动时,它偶尔会在不重新加载页面的情况下自行修复。它通常发生在表格的右下角,如第二个屏幕截图所示。
Here's my HTML/CSS:
这是我的 HTML/CSS:
<table width="730" border="0" cellpadding="4" cellspacing="0" style="border-collapse: collapse;">
<tr>
<td style="border:1px solid #ff9900;"></td>
<td style="border:1px solid #ff9900;"></td>
<td style="border:1px solid #ff9900;"></td>
</tr>
.
.
.
</table>
What gives? Any ideas? Thanks for your time & effort!
是什么赋予了?有任何想法吗?感谢您的时间和努力!
回答by toomanyairmiles
Moz has problems with border-collapse:collapse;
going back 10 years or so, it keeps getting fixed and then becoming buggy again (see bug track hereand here).
Mozborder-collapse:collapse;
在回溯 10 年左右时遇到问题,它不断得到修复,然后再次变得有问题(请参阅此处和此处的错误跟踪)。
Try adding a border to the table element like so:-
尝试向表格元素添加边框,如下所示:-
#your-table-name {border-collapse : collapse; border : 1px solid orange;}
#your-table-name td {border: 1px solid orange;}
Please also note that this is a coding question and should really go to stackoverflow. Its also helpful to post the browser version you're using.
另请注意,这是一个编码问题,应该真正转到stackoverflow。发布您正在使用的浏览器版本也很有帮助。