Skip to main content

angular - How to bind multiple style

app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
  divStyle ='color:teal; background-color:azure; padding:25px';
}
app.component.html

<h2>Angular Multiple Style Binding</h2>

<div [style]="divStyle">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    Phasellus sit amet dignissim justo, vitae maximus lectus.
    Integer molestie a nunc id ullamcorper.
    Etiam ornare est quis rhoncus maximus.
</div>
More Angular tutorials