急,问个css的置顶问题啊?

来源:百度知道 编辑:UC知道 时间:2024/05/25 17:26:07
急,问个css的置顶问题啊?
<style type="text/css">
#top body {
margin-top:0px;
}
</style>

<html>
<div id=top>

<body>
<table border=1 width=400>
<tr>
<td>123</td>
</tr>
</table>
</body>

</div>
</html>

急,问个css的置顶问题啊?

我设置了#top body{}的,就是说在top的id选择器下,让body置顶,

我在div里设了id=top的,为什么还不顶上去,怎么回事啊?

我写的没有错误啊?

在BODY外在套个<div>,第一次看到。。。。。。。
DIV要写在BODY里面,写在外面是没用滴。。。。。。。也是没有必要滴

margin-top:0px;
并非置顶
#top body {
margin-top:0px;
}

这个写法有点毛病 body本身为全局 , 再在前面加个#top 没什么效果
而且 <div id=top><body></body></div> 这个嵌套毛病太大了....
body是html文件主体中最大的一级 , 不可能在body外面在放一个div .这样浏览器根本放弃解析<div>的内容

body {margin: 0;}
#top {margin-top:0px;}

<html>
<head>
</head>
<body>
<div id=top>
<table border=1 width=400>
<tr>
<td>123</td>
</tr>
</table>
</div>
</body>
</html>