在table中tr的display:block在firefox下的问题


It's not a bug in the browser (or browsers) it's a bug in your code.

<tr> elements (table rows) have a default display proterty of display:
table-row; That is what makes them table rows.

If you apply display: block; to one then it is no longer a table row, it is
a standard block. It is as if you were to code:

<table border="1">
<tr><td>Col1</td><td>Col2</td></tr>
<div><td colspan="2">This cell should take 2 columns
but does not because of the display:block</td></div>
</table>

The reason it "appears" to work with IE is probably because IE is
error-correcting the display property for you.

Why do you want to do this anyway? The validator would have told you your
code is incorrect. Throw incorrect code at a browser and who knows what will
happen. 

 

 解决方法:
1、用display:table-row属性来调试,发现者FireFox下正常了,但IE是不支持改属性的,怎么办呢?用 JS来做判断,然后做兼容吧。
2、另外一个很简单也很可行的方法,就是用 display:' ' 这个属性dispaly后面不加任何的东西,很奇怪,这样就兼容了Firefox和IE了。

你可能感兴趣的:(firefox)