【发布时间】:2019-11-04 10:28:55
【问题描述】:
我正在开发一个 Angular Material 网页。
我在<mat-table> 的标题文本旁边添加了一个<mat-icon>。添加 mat-icon 后,图标和文本没有完全对齐。图标不是垂直居中的,看起来有点太高了。标题文本与其他列文本不对齐,看起来有点低。
我得到的最接近的是当我将带有文本的标签内的 mat-icon 移动时。
这是我的代码
<table mat-table [dataSource]="dataSource">
<ng-container matColumnDef="column1">
<th mat-header-cell *matHeaderCellDef style="text-align: center !important" [attr.colspan]="2"><h2>Column 1</h2></th>
</ng-container>
<ng-container matColumnDef="column2">
<th *matHeaderCellDef style="text-align: center !important" [attr.colspan]="2">
<h2><mat-icon class="pointer" style="padding-bottom: 0px; padding-right: 1px; cursor: pointer;" >arrow_left</mat-icon>Column 2</h2>
</th>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedGroupColumns; sticky: true"></tr>
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table >
【问题讨论】:
-
如果涉及到一张桌子,你应该展示更多。真的,我们需要查看呈现的 HTML 和任何适用的 CSS。
标签: html css angular typescript angular-material