css html,正文{}把我的页面弄乱了
我正在使用csscss html,正文{}把我的页面弄乱了,html,css,Html,Css,我正在使用css html, body { padding: 0; margin: 0; height: 100%; } 为我的网站添加标签,使一些div的高度达到100%,但当我将其添加到其中时,它会像这样扰乱我的html,但当我将其取出时,它会恢复正常,但左侧div的高度不是100%:?它为什么会这样做?我如何修复它 Html: 你不需要 html, body 你可以用 body {...}; 试试看。请注意,我只对示例进行了必要的更改 body {
html, body {
padding: 0;
margin: 0;
height: 100%;
}
为我的网站添加标签,使一些div的高度达到100%,但当我将其添加到其中时,它会像这样扰乱我的html,但当我将其取出时,它会恢复正常,但左侧div的高度不是100%:?它为什么会这样做?我如何修复它
Html:
你不需要
html, body
你可以用
body {...};
试试看。请注意,我只对示例进行了必要的更改
body {
padding: 0;
margin: 0;
}
#content #left {
height: 100%;
position: absolute;
top: 0;
z-index: -1; /* Hide right border below #header */
box-sizing: border-box;
/*padding: 0 0 0 10px;*/
padding-top: 30px; /* Height of #header */
}
如果负z索引在旧浏览器中不起作用,则使用以下样式
#header {
position: relative;
z-index: 1;
background: #fff;
}
您的html缺少一个结束div。它位于页脚文件中,不起任何作用。相同的结果,就像没有html、正文一样。
body {
padding: 0;
margin: 0;
}
#content #left {
height: 100%;
position: absolute;
top: 0;
z-index: -1; /* Hide right border below #header */
box-sizing: border-box;
/*padding: 0 0 0 10px;*/
padding-top: 30px; /* Height of #header */
}
#header {
position: relative;
z-index: 1;
background: #fff;
}