如何设置整个窗口的背景颜色(不是根据内容)?见下图

时间:2017-10-11 13:53:52

标签: html css angularjs twitter-bootstrap

当我创建新页面&设置background-color: black,它是根据内容而来,而不是整个窗口。

我不想将该属性放入HTML中。

我的意思是身体的大小是根据内容产生的。

我该如何解决?

我无法将position: fixed放入体内,因为有时我必须在其他页面上滚动&我也有脚贴在底部。

这是HTML:

<html>
<head>
</head>
<body ng-cloak>
    <notifications-bar class="notifications"></notifications-bar>

    <div ng-controller="MainCtrl as main">
        <ng-include src="'app/layout/header.html'"></ng-include>
        <div ng-view></div>
    </div>

    <footer class="footer_body">
        <ng-include src="'app/layout/footer.html'"></ng-include>
    </footer>
    <spinner></spinner>

</body>
</html>

这是CSS:

html, body {
        margin: 0;
        padding: 0;
     }

html {
        position: relative;
        min-height: 100%;
    }

body
    {
       min-height: 100% !important;
       margin-bottom:60px;
    }

.footer_body {
  position: absolute;
  bottom: 0;
  width: 100%;
  margin-bottom: 0px;
  height: 60px; /* height of footer */
  background-color: #666666;
}

This Image shows the footer is good at the bottom but then there is a gap in between body & footer

2 个答案:

答案 0 :(得分:0)

像这样更新CSS属性html正文背景颜色

html, body {
background-color:#aadb1e;
     }

答案 1 :(得分:0)

您是否尝试在background-color中设置.htmlcss file

&#13;
&#13;
html, body {
        margin: 0;
        padding: 0;
     }

html {
        position: relative;
        min-height: 100%;
    }

body
    {
       min-height: 100% !important;
       margin-bottom:60px;
    }
    
.special-bg{
  background-color: cyan;
}

.footer_body {
  position: absolute;
  bottom: 0;
  width: 100%;
  margin-bottom: 0px;
  height: 60px; /* height of footer */
  background-color: #666666;
}
&#13;
<html class='special-bg'>
  <body>
    <notifications-bar class="notifications"></notifications-bar>
    <div ng-controller="MainCtrl as main">
        <ng-include src="'app/layout/header.html'"></ng-include>
        <div ng-view></div>
    </div>

    <footer class="footer_body">
        <ng-include src="'app/layout/footer.html'"></ng-include>
    </footer>
    <spinner></spinner>
  </body>
</html>
&#13;
&#13;
&#13;