Angular Material Expansion Panel将所有嵌套的标签转换为块级标签?

huangapple go评论54阅读模式
英文:

Angular Material Expansion Panel turns all embedded tags into block tags?

问题

如果我有一个看起来像这样的文档:

<mat-accordion>
    <mat-expansion-panel>
        <mat-expansion-panel-header>
            <mat-panel-title>
                How To:
            </mat-panel-title>
        </mat-expansion-panel-header>
        <mat-panel-description class="help-text">

            Start here to prepare a <i>Connector</i> to link your contract:<br>
        </mat-panel-description>
     </mat-expansion-panel>
  </mat-accordion>

最终呈现的内容如下:

Start here to prepare a 
Connector
to link your contract.

对于<span>标签、<bold>等标签也是同样的情况。您可以通过在CSS中添加.mat-panel-description i { white-space: nowrap }来防止这种行为,但似乎应该有一种方法来防止mat-panel-description标签将内联标签转换为块标签。

英文:

If I have document that looks like this:

 <mat-accordion>
            <mat-expansion-panel>
                <mat-expansion-panel-header>
                    <mat-panel-title>
                        How To:
                    </mat-panel-title>
                </mat-expansion-panel-header>
                <mat-panel-description class="help-text">

                    Start here to prepare a <i>Connector</i> to link your contract:<br>
                </mat-panel-description>
             </mat-expansion-panel>
          </mat-accordion>

What gets render is something like:

Start here to prepare a 
Connector
to link your contract.

It does the same thing with <span> tags, <bold> etc. I can prevent the behavior by adding: .mat-panel-description i { white-space: nowrap } in the .css, but seems like there ought to be a way to prevent conversion of inline tags into block tags by the mat-panel-description tag.

}`

答案1

得分: 0

我刚刚检查了mat-expansion-panel-content中的默认样式,其中包括:

.mat-expansion-panel-content {
display: flex;
align-items: center;
}

所以基本上将您的内容包裹在一个"div"中将防止这种行为。

英文:

I just checked default styles in mat-expansion-panel-content, and there is

.mat-expansion-panel-content {
    display: flex;
    align-items: center;
}

So basicaly wrapping your content inside a "div" will prevent that behavior.

huangapple
  • 本文由 发表于 2023年6月2日 09:42:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76386656.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定