Angular · Junior · Question 56 of 75
How do you set an inline style with a unit, e.g. width in pixels?
<div [style.width.px]="size"></div>- ✓Correct answer: Bind
[style.width.px]- Angular appends the unit - 2
style="width: size" - 3Styles can only be set in CSS files
Explanation
Style bindings support units like .px, .% and .em. A null value removes the style.