user7948550
user7948550

Reputation:

How to style component background-color in angular 4 or 5?

How to style a component in angular? I use angular 5 and I tried this:

:host {
    background-color: green;
    size: 200px 200px;
}

And this:

app-root {
    background-color: green;
    size: 200px 200px;
}

Both approaches don't seem to work.

Upvotes: 5

Views: 8019

Answers (1)

Kirk Larkin
Kirk Larkin

Reputation: 93233

You also need to set the display property to something like block. This can be seen in the example from the docs:

:host {
    background-color: green;
    size: 200px 200px;
    display: block;
}

The display property is inline by default (you can see this in the developer tools, etc).

Upvotes: 13

Related Questions