![](/img/trans.png)
[英]How to dynamically add mat-icon to divs with angular renderer2?
[英]Angular How to add text on top of mat-icon
考虑这个 html:
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/> <mat-icon class="fa fa-folder" style="font-size:48px;"><span style="color: red; font-size: 30px">P</span></mat-icon>
这会导致文件夹图标和旁边的 P文本。
是否可以在文件夹图标顶部放置 P文本?
使用下面的代码
<mat-icon class="fa fa-folder" style="font-size:48px;"></mat-icon> <div style="color: red; font-weight: bold; font-size: 24px; margin-top:-1px; margin-left:15px">P</div>
这就是我一直在寻找的:
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/> <mat-icon class="fa fa-folder" style="font-size:40px; color: black"> <span style="color: red; font-weight: bold; font-size: 30px; margin-right: 12px; display:block; margin-top: -35px; margin-left: 10px">P</span> </mat-icon>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.