HTML背景颜色不变

时间:2014-07-10 02:09:18

标签: html css background

我将hg的bg设置为一种颜色,但似乎它不起作用。我已经包含了我的html和css来显示问题。

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

http://jsbin.com/tixacemo/1/edit?html,css,output

3 个答案:

答案 0 :(得分:2)

删除

CSS Document * /

来自CSS文件。这打破了文件的解析。正确的评论以/ *开头,以* /

结尾

答案 1 :(得分:0)

你的css的头像是这样的

@charset "utf-8";


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

删除CSS Document */

答案 2 :(得分:0)

在进行样式设置之前,您需要重置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; } 

将样式上方的样式粘贴到样式表的顶部,或使用<link href="reset.css" rel="stylesheet" type="text/css">将其导入HTML 然后你会看到背景颜色的变化。