我的background-color属性没有完全填充空间(请参见图片)(图片显示页面内容的右上方和顶部,但背景颜色未填充空白)
代码如下:
<body style="background-color: #163a4b; color: white">
<app-navbar></app-navbar>
<div style="margin: 15px">
<router-outlet></router-outlet>
</div>
</body>
<body style="background-color: #163a4b; color: white">
<app-navbar></app-navbar>
<div style="margin: 15px">
<router-outlet></router-outlet>
</div>
</body>
答案 0 :(得分:0)
所需的附加操作是在index.html而不是组件的HTML上做背景色。这样就可以解决问题。
之前(app.component.html)
<body style="background-color: #163a4b; color: white">
<app-navbar></app-navbar>
<div style="margin: 15px">
<router-outlet></router-outlet>
</div>
</body>
之后(index.html)
<!doctype html>
<html lang="en">
<body style="background-color: #163a4b;">
<app-root></app-root>
</body>
</html>