如何在CSS中设置整个页面的背景颜色 [英] how to set the background color of the whole page in css

查看:2531
本文介绍了如何在CSS中设置整个页面的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将 yumdom.com 上的页面背景颜色设置为黄色。



我尝试了以下方法,结果失败:

  body {background-color:yellow;} / * only a * / 

#doc3 {background-color:yellow;} / *结果与上面相同* /

#bd {background-color:黄色;} / *结果与上面相同* /

#yui-main {background-color:yellow;} / *一个矩形变为黄色,结束于内容结束处。 * /

另外请注意,如果在Chrome中的开发人员工具我突出显示了上述任何一个html元素,我只突出显示了页面的某个部分。页脚和内容下面的部分保持不突出显示。



我希望黄色填充页眉和页脚之间的整个空间,不留空白区域。



请注意,我们使用YUI复位,字体和网格CSS模板V 2.8.0r4



非常感谢!

解决方案

我已经写过这个答案,但它似乎已被删除。问题在于YUI向HTML元素添加了 background-color:white 。我重写了这一点,并从那里处理一切都很容易。

I am trying to set the background color of the page at yumdom.com to yellow.

I have tried the following and it fails:

body{ background-color: yellow;} /*only a sliver under the header turns yellow.*/

#doc3{ background-color: yellow;} /*result same as above*/

#bd { background-color: yellow;} /*result same as above*/

#yui-main { background-color: yellow;} /*a rectangle turns yellow ending at where the content ends. I want this rectangle to extend all the way to the footer.*/

Also note that if in the developer tools in Chrome I highlight either one of the html elements above, I get only a certain portion of the page highlighted. A footer and the section below the content remain un-highlighted.

I want the yellow to fill the entire space between the header and the footer and leave no white space out.

Note that we are using YUI Reset, Fonts, and Grids CSS templates V 2.8.0r4

Many thanks!

解决方案

I already wrote up the answer to this but it seems to have been deleted. The issue was that YUI added background-color:white to the HTML element. I overwrote that and everything was easy to handle from there.

这篇关于如何在CSS中设置整个页面的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆