We have several ways to add styles to a component:
- inline in HTML template
- setting styles or style metadata
- with CSS import
Built-in styles:
@Component({
templateUrl: 'test.html',
styles: [`
.card {
height: 20px;
width: 80px;
}
`],
})
Use external style sheets:
@Component({
styleUrls: ['css/mystyle.css'],
templateUrl: 'test.html',
})
CSS Import:
@import 'hero-details-box.css';
Component styles also have special shadow selectors in the DOM style. for example, a CSS theme class may be used in a document:
:host-context(.theme-light) h2 {
background-color: #eef;
}
, , HTML CSS :
quest-summary.component.ts
quest-summary.component.html
quest-summary.component.css
, , .
SAS, ANGULAR2 SASS .
styleUrls: ['./sassexample.component.scss']
, :
PrimeNG
Material
NG bootsrap
, .
!!