my question is very simple, I am developing an angular 4 app, and I need to place an image as a background in my component called Home, that occupies the entire browser window ONLY in my Home component... Below shows the structure of my application:
index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MyAngularApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
app.component.html:
<router-outlet></router-outlet>
app.component.ts:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
}
home.component.html:
<div class="background">
<p>Example</p>
</div>
home.component.css:
.background {
width: 100%;
background: url('../../assets/background.jpg') no-repeat;
background-size: cover;
color: white;
text-align: center;
}
As you can see, what I need is that when rendering my home component, it shows as a background of my home component an image that occupies the entire browser window, the problem is that as I have tried ... the image does not take up the full screen of the browser, the image only occupies the background of the example sentence, and it is not responsive either.
Many thanks!
