简体   繁体   English

IE8不尊重表填充

[英]IE8 doesn't respect table padding

This is a screenshot of a table in Chrome 5. 这是Chrome 5中表格的屏幕截图。

铬

The same table rendered in IE8: 在IE8中呈现的同一个表:

IE8

You can view the page here: http://labs.pieterdedecker.be/vspwpg/?page_id=96 您可以在此处查看该页面: http//labs.pieterdedecker.be/vspwpg/?page_id = 96

This CSS rule adds the padding that IE8 won't respect: td#content table.subitems { padding: 5px; } 这个CSS规则添加了IE8不会遵守的填充: td#content table.subitems { padding: 5px; } td#content table.subitems { padding: 5px; }

Try adding the padding to the td/th elements under the table, not the table itself. 尝试将填充添加到表下的第t / th个元素,而不是表本身。 The table cells / headings get zeroed out by *{margin:0;padding:0;} as well, so you have to explicitly specify. 表格单元格/标题也被*{margin:0;padding:0;}归零,因此您必须明确指定。

Edit: If you don't mean to put padding on every table cell/heading then try a margin on the table or padding on a table wrapper div. 编辑:如果你不是要在每个表格单元/标题上放置填充,那么在表格上填写边距或在表格包装器div上填充。

I ran into the same problem with my site. 我的网站遇到了同样的问题。 The class was applied to the <td> tag but its padding was not showing up. 该类已应用于<td>标记但其填充未显示。 Then I declared the padding inline, and it showed up fine. 然后我宣布填充内联,它显示正常。 I nearly put a fist through my monitor, but when I realized that would hurt me and not IE, I refrained. 我几乎把拳头放在我的显示器上,但当我意识到这会伤害我而不是IE时,我忍住了。 It's not pretty, but it works. 它不漂亮,但它的工作原理。

<td class="doesntMatterBecauseIEHatesYou" style="padding:10px;">Horray, IE doesn't hate you anymore. But you still hate IE.</td>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM