如何使整个网页成为一种颜色?

时间:2015-03-19 03:59:32

标签: html css

我在更改网页的背景颜色时遇到了一些麻烦,似乎无法找到解决方案。

我在页面上有内容,但是当内容停止时黑色背景停止。我试图扩展内容,使用正文选择器和通用选择器......但这些都不起作用。

是否有:height:100%属性,以便它可以保留所有屏幕的颜色?

3 个答案:

答案 0 :(得分:4)

将其应用于html标签。

html{
    background-color: black;
}

答案 1 :(得分:1)

您的身体内容溢出了具有背景颜色的容器。这就是为什么你看到背景颜色停止但内容继续。要解决此问题,请确保容器包含内容。

答案 2 :(得分:0)

我认为你正在寻找vw,vh,vmax,vmin Units

你可以在你的身体标签上使用它

body{
  padding: 0;
  height: 100vh; /*add this to fill the screen*/
  background: red /*set the background color here*/
}
相关问题