简体   繁体   中英

Need background-color to fill space

My background-color attribute is not filling the space completely (see image) 背景未填充 (Image shows page content to right and top but background color does not fill the white space)

Here is what the code looks like:

<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> 

The required addition is to do the background color on the index.html instead of the component's HTML. That'll solve the issue.

Before (app.component.html)

<body style="background-color: #163a4b; color: white">
    <app-navbar></app-navbar>
    <div style="margin: 15px">
        <router-outlet></router-outlet>
    </div>
</body>

After (index.html)

<!doctype html>
<html lang="en">
<body style="background-color: #163a4b;">
  <app-root></app-root>
</body>
</html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM