html - 需要对 Angular 分割垫表格单元格并添加值

标签 html css angular angular5 mat-table

我需要对 Angular 划分 Mat Table 单元格。并需要根据值添加值和颜色。像这样...

enter image description here

现在我将单元格分成四个。并添加值和颜色... enter image description here

这是我的代码.html

<ng-container matColumnDef="RearIdler">
            <mat-header-cell class="eval-header" *matHeaderCellDef> {{Translate('Rear Idler')}} </mat-header-cell>
            <mat-cell *matCellDef="let row" class="no-padding">
                <div>
                    <span class="component-span top {{getComponentHoursClass(7,1, row.Components)}}">
                        {{getComponentHours(7,1, row.Components)}}
                    </span>
                    <span class="component-span top {{getComponentClass(7,1, row.Components)}}">
                        {{getComponentValue(7,1, row.Components)}}%
                    </span>
                </div>
                <div>
                    <span class="component-span bottom {{getComponentHoursClass(7,2, row.Components)}}">
                        {{getComponentHours(7,2, row.Components)}}
                    </span>
                    <span class="component-span bottom {{getComponentClass(7,2, row.Components)}}">
                        {{getComponentValue(7,2, row.Components)}}%
                    </span>
                </div>
            </mat-cell>
        </ng-container>

.css

.component-span {
    display:block;
    border-radius: 4px;
    text-align: center;
    margin: 1px;
    padding: 4px 2px;
    font-size: 12px;
}

最佳答案

如 CSSDesk 上所示 http://www.cssdesk.com/RERXd

CSS/HTML

    div.all { 
      margin:20px;
      width:200px;
      height:120px ;
      background-color:#ee0;
      position:relative;
      font-size:40px;
    }
    div.top {
      width: 0;
      height: 0;
      border-top: 120px solid #ffb;
      border-right: 200px solid transparent;
    }
    div.mid {
      position:absolute;
      top:0;
      left:0;
    }
    div.bot {
      position:absolute;
      bottom:0;
      right:0;
    }
    div.mid, div.bot { 
      padding:5px;
    }
    <table><tr><td>
    <div class="all">  
      <div class="top"></div>
      <div class="mid">-261</div>
      <div class="bot">22.1%</div>
    </div>
    </td></tr></table>

enter image description here

关于html - 需要对 Angular 分割垫表格单元格并添加值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53698051/

相关文章:

html - 这是什么意思 @-moz-document url-prefix()

c# - 为什么我的字符串值在插入 SQL 数据库时会累积空格?

html - 如何在 emacs 导出的 HTML 中集成图像(通过本地路径设置)?

ios - HTML5 电子邮件 - iOS - 禁用单词建议?

css - 如果我使用 em 来调整文本大小,我是否也应该在 em 中定义宽度、高度、边距、填充、行高?

javascript - IONIC - 构造函数中的 BluetoothSerial 使所有元素不可见

javascript - 扩展面板组标题和迭代子对象

jquery 设置高度等于图像高度大约 50% 的时间有效

html - 将 list-style-image 与 <li> 文本对齐

angular - 辅助路由是否仅适用于根组件?