How to center right-aligned numbers in table column using CSS?

前端 未结 11 2085
傲寒
傲寒 2021-02-02 10:54

The picture below illustrates what I\'m trying to accomplish:

\"enter

UPD. As you

11条回答
  •  醉梦人生
    2021-02-02 11:25

    You can approximate this with CSS. Create a class:

    td.rt-ctr {
      text-align:right;
      padding-right:33%;    
    }
    

    Then call the class in your chart:

    Item 1 100.25
    Item 2 99.75

    Depending upon the width of the column, chart and longest data entry, you may need to adjust the percentage in the CSS. This approach isn't perfect, but it is responsive and is a pure CSS method.

提交回复
热议问题