表mozilla 中的高度
我这里有一个包含两个字段的表,其中一个字段的高度为 1 像素,另一个字段的高度为 100%。这个例子在 Google Chrome 中看起来很清楚。但它在 Mozilla 中不起作用。如何在 Mozilla 中修复?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
*{margin: 0; padding: 0;}
html, body{position: relative; width: 100%; height: 100%; overflow: hidden;}
table{height: 100%; width: 100%; position: relative;}
</style>
</head>
<body>
<table cellpadding="0" cellspacing="0" height="100%">
<tbody height="100%" >
<tr>
<td height="100%" valign="top">
<div style="overflow: auto; height: 100%">
sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />a1
afasdasd sdfs sdv
</div>
</td>
</tr>
<tr>
<td height="1" valign="top">
test<br />test<br />test<br />test<br />test<br />
</td>
</tr>
</tbody>
</table>
</body>
</html>
I have here a table with two fields in which the height of a 1-pixel and the other 100 percent. This example clearly looks in Google Chrome. But it does not work in Mozilla. How to fix in Mozilla?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
*{margin: 0; padding: 0;}
html, body{position: relative; width: 100%; height: 100%; overflow: hidden;}
table{height: 100%; width: 100%; position: relative;}
</style>
</head>
<body>
<table cellpadding="0" cellspacing="0" height="100%">
<tbody height="100%" >
<tr>
<td height="100%" valign="top">
<div style="overflow: auto; height: 100%">
sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />sdfsdf<br />a1
afasdasd sdfs sdv
</div>
</td>
</tr>
<tr>
<td height="1" valign="top">
test<br />test<br />test<br />test<br />test<br />
</td>
</tr>
</tbody>
</table>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定 Mozilla 引擎如何解释
标记的 HTML 高度属性,但使用 CSS 进行样式化可能会获得更好的结果。您是否尝试过类似的操作:
在 HTML 中...
在您的样式块中...
或内联...
更新:CSS 高度属性仅适用于块级元素,因此您可以使用:
这会起作用,但会被人皱眉。可能更好的方法是在表格单元格内放置一个 DIV 并对其应用高度。
HTML...
和 CSS:
I'm not sure how the Mozilla engine is interpreting the HTML height attribute for the
<td>
tag, but you might get better results using CSS for the styling instead. Have you tried something like:In the HTML...
In your style block...
Or inline...
UPDATE: The CSS height attribute will only work on a block level element, so you can use:
This will work, but will be frowned upon. Probably better to put a DIV inside the table cell and apply the height to that.
The HTML...
And the CSS:
它最初在 Chrome 10 和最新的 FF 中都对我有用。
这个例子帮助我弄清楚为什么“表格中99%或100%高度大小的行在Chrome中不能自动拉伸”。
这个错误在很多地方都被讨论过,但没有太多解决方案。
因此,通过这个工作示例,我设法找到了解决方案:
我所要做的就是“在 Chrome 10 中自动调整 99% 或 100% 高度的表格行就是使父表格的高度为 100%”
It worked for me initially in both Chrome 10 and latest FF.
And this example helped me to figure out why "99% or 100% height sized row in a table is not auto stretchable in Chrome".
This bug was discussed in many places but no much solution were..
So, with this working example I've managed to figure out the solution:
all I had to do is to "make a 99% or 100% height row of table to be auto resized in Chrome 10 is to make the parent table's height 100%"