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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
you can do this easily.
<p [style.width.%]="someValue"> ... </p>
<p [style.height.%]="someValue"> ... </p>
ref
回答2:
you have to declare the css properties in .css file.
for example:
div {
height: 200px;
width: 50%;
background-color: powderblue;
}
回答3:
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'">