Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
css html,正文{}把我的页面弄乱了_Html_Css - Fatal编程技术网

css html,正文{}把我的页面弄乱了

css html,正文{}把我的页面弄乱了,html,css,Html,Css,我正在使用css html, body { padding: 0; margin: 0; height: 100%; } 为我的网站添加标签,使一些div的高度达到100%,但当我将其添加到其中时,它会像这样扰乱我的html,但当我将其取出时,它会恢复正常,但左侧div的高度不是100%:?它为什么会这样做?我如何修复它 Html: 你不需要 html, body 你可以用 body {...}; 试试看。请注意,我只对示例进行了必要的更改 body {

我正在使用css

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;
}