Check out example codes for "ngstyle". It will help you in understanding the concepts better.

Code Example 1

<div [ngStyle]="{'background-color':person.country === 'UK' ? 'green' : 'red' }"></<div>

Code Example 2

content_copy
      
      <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>

Learn ReactJs, React Native from akashmittal.com