简体   繁体   English

mat-icon 右填充? Angular材料

[英]mat-icon right padding? Angular Material

Angular Material Icons: Angular 材质图标:

I have a mat-icon that I want to be beside the text.我有一个垫子图标,我想在文本旁边。 Nothing I do will reduce the space between the icon and the text though.我所做的一切都不会减少图标和文本之间的空间。

在此处输入图像描述

Based on this HTML:基于此 HTML:

      <span>
        <mat-icon [inline]="true" style="display:inline;">locked</mat-icon>
        <span AMELIA SMITH</span>
      </span>

remove the inline and add custom css to align the text, current values are not accurate but you could change them删除内联并添加自定义 css 以对齐文本,当前值不准确但您可以更改它们

in CSS:在 CSS 中:

mat-icon {
  vertical-align:middle;
}

.a {
  padding-top:8px;
  vertical-align:middle;
}

or only或仅

mat-icon {
  vertical-align:text-bottom;
}

and in html:在 html 中:

<span>
  <mat-icon >locked</mat-icon>
  <span class="a"> AMELIA SMITH</span>
</span>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM