当我创建新页面&设置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;
}
答案 0 :(得分:0)
像这样更新CSS属性html正文背景颜色
html, body {
background-color:#aadb1e;
}
答案 1 :(得分:0)
您是否尝试在background-color
中设置.html
至css file
?
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;