简体   繁体   English

如何在mat2 /材质上将mat-cell内容与图标对齐?

[英]How to align mat-cell content with icon to right on angular2/material?

To begin with my Code: 我的代码开始

<!-- Edit Column -->
<ng-container mdColumnDef="edit">
  <md-header-cell *mdHeaderCellDef> {{'companies.edit-column' | translate}}</md-header-cell>
  <md-cell *mdCellDef="let element"><a (click)="toCompany(element.id)"><md-icon class="md-dark">edit</md-icon></a></md-cell>
</ng-container>

The Requirement is to adjust the position of the edit icon to the right (with respect of material design's right padding)? 要求是将编辑图标的位置调整到右侧(关于材料设计的右侧填充)? Right now it appears to be forcibly left-docked. 现在它似乎被强行左对接了。 Applying a style="{text-align: right}" to md-cell does not work. style="{text-align: right}"应用于md-cell不起作用。

version of libs : libs版本

"@angular/material": "2.0.0-beta.10"
"@angular/cdk": "^2.0.0-beta.10",
"@angular/common": "^4.1.3"

Use either of these: 使用以下任何一种:

mat-cell{
  display:flex !important;
  justify-content:flex-end!important;

}

::ng-deep .mat-cell{
  display:flex !important;
  justify-content:flex-end!important;
}

DEMO DEMO

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

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