Rambo
Rambo

Reputation: 45

angular 4.3 [style.box-shadow] or [style.boxShadow] not working

I've tried applying this code to a div and I don't see any result.

 [style.box-shadow]="'0px 0px 10.5px rgba(0, 0, 0, 0.3)'"

All other style properties are working fine for ex.

  [style.border], [style.color]="textColor" etc.

What's the trick? :(

Upvotes: 2

Views: 3039

Answers (1)

zmag
zmag

Reputation: 8251

rgba() doesn't work with that notation but hashtag work with it like [style.box-shadow]="'0px 0px 10.5px #000'".

If you need rgba() notation, use NgStyle directive instead of [style.prop] notation.

<div [ngStyle]="{'box-shadow': '0px 0px 10.5px rgba(0, 0, 0, 0.3)'}"></div>

Upvotes: 3

Related Questions