HTML5标准,body高度问题

河豚 2016-04-12 04:35:51
在IE9下,一下代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<Link Rel="STYLESHEET" Href="hs.CSS" Type="text/css">
<title>Supcon Get view </title>
<style type="text/css">
html,body{height:100%; width:100%; overflow:hidden; margin:0; padding:0;}
.a1{width:100%; height:100%; color:#fff; background-color:#369; text-align:center;}
</style>
</head>
<body>
<table height="100%" width="100%">
<tr width = "100%">
<td>
<table align="center" width = "100%" height = "100%">
<tr>
<td>
<div class="a1">div1</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<Link Rel="STYLESHEET" Href="hs.CSS" Type="text/css">
<title>Supcon Get view </title>
<style type="text/css">
html,body{height:100%; width:100%; overflow:hidden; margin:0; padding:0;}
.a1{width:100%; height:100%; color:#fff; background-color:#369; text-align:center;}
</style>
</head>
<body>
<table height="100%" width="100%">
<tr width = "100%">
<td>
<table align="center" width = "100%" height = "100%">
<tr>
<td>
<div class="a1">div1</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
代码,两个代码只缺少<!DOCTYPE html>
执行出来的效果,完全不一样。为什么?
怎么将加了<!DOCTYPE html>的代码执行的效果和没有加执行的效果变成一致,怎么改。
...全文
510 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
limanman7080 2016-04-20
  • 打赏
  • 举报
回复
感谢老王送分
qq_33211559 2016-04-20
  • 打赏
  • 举报
回复
感谢老王送分
虫虫爬呀爬 2016-04-20
  • 打赏
  • 举报
回复
感谢老王送分
cnsqq_mapan 2016-04-20
  • 打赏
  • 举报
回复
感谢老王送分
河豚 2016-04-20
  • 打赏
  • 举报
回复
这节奏,分数都没人要的吗
河豚 2016-04-15
  • 打赏
  • 举报
回复
知道问题了。 因为HTML5的body高度设置以后,某个子项的高度没有设置的话,其子项的子项的高度就无效。所以两个代码执行不一致。 只需要将第一个修改为 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="GENERATOR" content="Microsoft FrontPage 6.0"> <Link Rel="STYLESHEET" Href="hs.CSS" Type="text/css"> <title>Supcon Get view </title> <style type="text/css"> html,body{height:100%; width:100%; overflow:hidden; margin:0; padding:0;} .a1{width:100%; height:100%; color:#fff; background-color:#369; text-align:center;} </style> </head> <body> <table height="100%" width="100%"> <tr width = "100%" height=“100%”> <td height=“100%”> <table align="center" width = "100%" height = "100%"> <tr height=“100%”> <td height=“100%”> <div class="a1">div1</div> </td> </tr> </table> </td> </tr> </table> </body> </html>
1. HTML对象获取问题 3 2. const问题 3 3. event.x与event.y问题 3 4. window.location.href问题 3 5. frame问题 3 6. 模态和非模态窗口问题 3 7. firefox与IE的父元素(parentElement)的区别 3 8. document.formName.item(”itemName”) 问题 3 9. 集合类对象问题 3 10. 自定义属性问题 3 11. input.type属性问题 3 12. event.srcElement问题 3 13. body载入问题 3 14. 事件委托方法 3 15. Table操作问题 3 16. 对象宽高赋值问题 3 Ø CSS 3 1. cursor:hand VS cursor:pointer 3 2. innerText在IE中能正常工作,但在FireFox中却不行. 3 3. CSS透明 3 4. css中的width和padding 3 5. FF和IE BOX模型解释不一致导致相差2px 3 6. IE5 和IE6的BOX解释不一致 3 7. ul和ol列表缩进问题 3 8. 元素水平居中问题 3 9. Div的垂直居中问题 3 10. margin加倍的问题 3 11. IE与宽度和高度问题 3 12. 页面的最小宽度 3 13. DIV浮动IE文本产生3象素的bug 3 14. IE捉迷藏的问题 3 15. float的div闭合;清除浮动;自适应高度 3 16. 高度不适应 3 17. IE6下图片下有空隙产生 3 18. 对齐文本与文本输入框 3 19. LI中内容超过长度后以省略号显示 3 20. 为什么web标准中IE无法设置滚动条颜色了 3 21. 为什么无法定义1px左右高度的容器 3 22. 链接(a标签)的边框与背景 3 23. 超链接访问过后hover样式就不出现的问题 3 24. FORM标签 3 25. 属性选择器(这个不能算是兼容,是隐藏css的一个bug) 3 26. 为什么FF下文本无法撑开容器的高度 3

50,526

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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