Harish
Harish

Reputation: 157

Resizing height & width of the div in percentage not pixel by using angular 5

I am new to angular 5. I have to implement Resizing height & width of the div in percentage by using angular 5. Please help me to implement this functionality.

Upvotes: 0

Views: 1827

Answers (3)

varman
varman

Reputation: 8894

Better you use it inside css/ .ts file

@Component({
  selector: 'your-selector',
  styles: [`   
      .change-hight-width{
        height: 200px;
        width:200px;
      }   
  `]
//rest of the code
    })

in html

<div [ngClass]="'change-hight-width'">

Upvotes: 0

Abdul Rafay
Abdul Rafay

Reputation: 3391

you can do this easily.

<p [style.width.%]="someValue"> ... </p>
<p [style.height.%]="someValue"> ... </p>

ref

Upvotes: 1

dev-assassin
dev-assassin

Reputation: 271

you have to declare the css properties in .css file.

for example:

div {
    height: 200px;
    width: 50%;
    background-color: powderblue;
}

Upvotes: 0

Related Questions