Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.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
HTML背景颜色不变_Html_Css_Background - Fatal编程技术网

HTML背景颜色不变

HTML背景颜色不变,html,css,background,Html,Css,Background,我将html的背景设置为颜色,但它似乎不起作用。我已经包括了我的html和css来说明这个问题 html {height:100%; background-color:#e2e2e2;} 移除 CSS文档*/ 从CSS文件。这将中断对文件的解析。一个恰当的注释以/*开头,以*/结尾,在你的css头上这样放置 @charset "utf-8"; html, body{ height:100%; background-color:#e2e2e2;z-index:999; } 删除CS

我将html的背景设置为颜色,但它似乎不起作用。我已经包括了我的html和css来说明这个问题

html {height:100%; background-color:#e2e2e2;}
移除

CSS文档*/


从CSS文件。这将中断对文件的解析。一个恰当的注释以/*开头,以*/

结尾,在你的css头上这样放置

@charset "utf-8";


html, body{
    height:100%; background-color:#e2e2e2;z-index:999;
}

删除
CSS文档*/

在进行样式设置之前,需要重置html元素:

/*
=RESET :Eric Meyer Reset Reloaded
(http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/)
---------------------------------------- */
html,body,div,span,applet,object,iframe,
h1,h2,h3,h4,h5,h6,p,blockquote,pre,
a,abbr,acronym,address,big,cite,code,
del,dfn,em,font,img,ins,kbd,q,s,samp,
small,strike,strong,sub,sup,tt,var,
dl,dt,dd,ol,ul,li,
fieldset,form,label,legend,
table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
:focus{outline:0;}
body{line-height:1;color:black;background:white;}
ol,ul{list-style:none;}
table{border-collapse:separate;border-spacing:0;}
caption,th,td{text-align:left;font-weight:normal;}
blockquote:before,blockquote:after,
q:before,q:after{content:"";}
blockquote,q{quotes:"" "";}

/* html 5 Specific */
article,aside,canvas,details,div,figcaption,figure,
footer,header,hgroup,menu,nav,section,summary,
time,mark,audio,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;}
article,aside,canvas,details,figcaption,figure,
footer,header,hgroup,menu,nav,section,summary,
time,mark,audio,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;}
article,aside,canvas,details,figcaption,figure,
footer,header,hgroup,menu,nav,section,summary{display:block;}


/* www.aestheticallyloyal.com/public/optimize-legibility/ */
body { text-rendering: optimizeLegibility; }
/* maxvoltar.com/archive/-webkit-font-smoothing */
html { -webkit-font-smoothing: antialiased; } 
将上面的样式粘贴到样式表顶部,或使用

将其导入HTML
然后您将看到背景颜色的变化。

删除css文件
css文档中的这一行*/
。检查是否同意。流散的注释阻止了css的第一部分解析。啊,我瞎了!谢谢