Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何根据条件添加样式_Html_Css_Angular - Fatal编程技术网

Html 如何根据条件添加样式

Html 如何根据条件添加样式,html,css,angular,Html,Css,Angular,我正试图根据我的输入复选框将css添加到我的div中 <div class="pvreveal" [style]="ShowHideSection ? 'overflow:scroll;height:483px':''" > <input id="isDelivery" type="checkbox" [(ngModel)]="ShowHideSection " /> </div 通过使用[ngClass]。我不太喜欢内联风格 //CSS //组成部分 e

我正试图根据我的输入复选框将css添加到我的div中

<div class="pvreveal"  [style]="ShowHideSection ? 'overflow:scroll;height:483px':''"  >
 <input id="isDelivery" type="checkbox" [(ngModel)]="ShowHideSection " />
</div


通过使用
[ngClass]
。我不太喜欢内联风格

//CSS

//组成部分

export class MyComponent {

    public ShowHideSection : boolean = true;
}
//HTML

<div class="pvreveal"  [ngClass]="{'myClass' : ShowHideSection}"  >
 <input id="isDelivery" type="checkbox" [(ngModel)]="ShowHideSection " />
</div>

使用
[ngClass]
。我不太喜欢内联风格

//CSS

//组成部分

export class MyComponent {

    public ShowHideSection : boolean = true;
}
//HTML

<div class="pvreveal"  [ngClass]="{'myClass' : ShowHideSection}"  >
 <input id="isDelivery" type="checkbox" [(ngModel)]="ShowHideSection " />
</div>


这是否回答了您的问题i、 e.
Text
这是否回答了您的问题i、 e.
Text