【问题标题】:How to expand parent block height when ng if displayng if显示时如何扩展父块高度
【发布时间】:2022-01-19 17:40:05
【问题描述】:

当 ng-If 为 true 时,我需要更改父元素的高度并显示一个矩形,但不知道如何。

我的结构如下:

<div class="parent">
    <form> 
        <div ng-if="sth" class="child"> 
        </div>
    </form>
</div>

当 if 语句为真时,父高度必须改变。

【问题讨论】:

标签: css angularjs


【解决方案1】:

您的问题有点模糊...不确定您要设置的高度等...但这是一个示例:

<div class="parent" ng-style="{ height: sth ? '400px' : 'auto' }">
    <form> 
        <div ng-if="sth" class="child"> 
        </div>
    </form>
</div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-27
    • 1970-01-01
    • 2011-06-15
    • 2018-10-06
    • 2019-07-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多