关于table布局的问题

「已注销」 2009-06-25 03:14:49
代码如下:

<!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 id="Head1" runat="server">
<title></title>
<style type="text/css">
* { margin: 0px; }
html, body { height: 100%; }
</style>
</head>
<body>
<table style="width:100%; height:100%; ">
<tr><td style="background-color:#164331; height:100px;">1</td></tr>
<tr><td style="height:auto">2</td></tr>
</table>
</body>
</html>

表格把整个页面占满,上边那个单元格固定高度100px,下边则自动高度
页面在 firefox 跟 谷歌浏览器 显示都是正常的,但是在IE就变样了,IE中上边的那个单元格占了大部分空间,请问高手这是怎么回事,该怎么修改。要求保留DOCTYPE
...全文
102 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
baozhifei 2009-06-29
  • 打赏
  • 举报
回复

<!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 id="Head1" runat="server">
<title> </title>
<style type="text/css">
* { margin: 0px; }
body { height: 100%; }
</style>
</head>
<body>
<table style="width:100%; height:100%; ">
<tr> <td style="background-color:#164331; height:100px;">1 </td> </tr>
<tr> <td style="height:auto">2 </td> </tr>
</table>
</body>
</html>

Firefox,IE7显示一样!这样就是楼主要的结果了吧。
「已注销」 2009-06-29
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 baozhifei 的回复:]
HTML code<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headid="Head1"runat="server"><title></title><styletype="text/css">*{margin:0px;}body{height:100%;}</style></head><body><tablestyle="width:100%; height:100%; "><tr><tdstyle="background-color:#164331; hei…
[/Quote]

IE6呢
「已注销」 2009-06-27
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 lzp4881 的回复:]
<!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 id="Head1" runat="server">
<title> </title>
<style type="text/css">
* { margin: 0px; }
body { height: 100%; }
</style>
</head>
<body>
<table style="width:100%; height:100%; ">
<tr> <td style="background-color:#164…
[/Quote]


各位大哥这样还是不行
chengliwangtao 2009-06-26
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 cenzige 的回复:]
除了定义body样式外。还有一个办法就是去掉
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
这行
[/Quote]

顶起
T_T_zz 2009-06-25
  • 打赏
  • 举报
回复
关注
岑子哥 2009-06-25
  • 打赏
  • 举报
回复
罪魁祸首是因为你定义了
html的样式
岑子哥 2009-06-25
  • 打赏
  • 举报
回复
除了定义body样式外。还有一个办法就是去掉
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
这行
lzp4881 2009-06-25
  • 打赏
  • 举报
回复
<!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 id="Head1" runat="server">
<title> </title>
<style type="text/css">
* { margin: 0px; }
body { height: 100%; }
</style>
</head>
<body>
<table style="width:100%; height:100%; ">
<tr> <td style="background-color:#164331; height:100px;">1 </td> </tr>
<tr> <td style="height:auto">2 </td> </tr>
</table>
</body>
</html>
shenzhenNBA 2009-06-25
  • 打赏
  • 举报
回复
呵呵,各个浏览器兼容问题....

61,128

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧