Try this
<div class="home-component"
[style.width.px]="width"
[style.height.px]="height">Some stuff in this div</div>
[Updated]:
To set in % use
[style.height.%]="height">Some stuff in this div</div>
More Related Contents:
- In RC.1 some styles can’t be added using binding syntax
- How to style child components from parent component’s CSS file?
- How and where to use ::ng-deep?
- Angular-cli from css to scss
- angular 2 ngIf and CSS transition/animation
- How to overwrite angular 2 material styles?
- Dynamic styleUrls in angular 2?
- The use of /deep/ and >>> in Angular 2
- Styling mat-select in Angular Material
- Angular dynamic background images
- Angular 2: How to style host element of the component?
- CSS file blocked: MIME type mismatch (X-Content-Type-Options: nosniff)
- Change style of pseudo elements in angular2
- Changing border color in mat-form-field
- Grid Styling – Overwrite style of ag-grid
- I do not want to inherit the child opacity from the parent in CSS
- CSS 100% height with padding/margin
- What is difference between justify-self, justify-items and justify-content in CSS grid?
- Style disabled button with CSS
- Z-Index Relative or Absolute?
- What’s the difference between `all: unset` and `all: revert’
- rotate3d shorthand
- How to link a CSS file from HTML file?
- Build list of selectors with LESS
- Set div height equal to screen size
- Styling the new twitter widget (embedded timeline)
- What CSS3 features still need vendor prefixes?
- How to fix unexpected column order in bootstrap 4?
- selector for nth nested elements
- Bootstrap Navbar list items/links not showing