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

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

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

问题

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

  1. <mat-accordion>
  2. <mat-expansion-panel>
  3. <mat-expansion-panel-header>
  4. <mat-panel-title>
  5. How To:
  6. </mat-panel-title>
  7. </mat-expansion-panel-header>
  8. <mat-panel-description class="help-text">
  9. Start here to prepare a <i>Connector</i> to link your contract:<br>
  10. </mat-panel-description>
  11. </mat-expansion-panel>
  12. </mat-accordion>

最终呈现的内容如下:

  1. Start here to prepare a
  2. Connector
  3. 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:

  1. <mat-accordion>
  2. <mat-expansion-panel>
  3. <mat-expansion-panel-header>
  4. <mat-panel-title>
  5. How To:
  6. </mat-panel-title>
  7. </mat-expansion-panel-header>
  8. <mat-panel-description class="help-text">
  9. Start here to prepare a <i>Connector</i> to link your contract:<br>
  10. </mat-panel-description>
  11. </mat-expansion-panel>
  12. </mat-accordion>

What gets render is something like:

  1. Start here to prepare a
  2. Connector
  3. 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

  1. .mat-expansion-panel-content {
  2. display: flex;
  3. align-items: center;
  4. }

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:

确定