简体   繁体   English

如何更改 Antd 表中的 fontSize

[英]How to change the fontSize in an Antd table

I tried to change the fontSize , but it did not take effect:我尝试更改fontSize ,但没有生效:

<Table
  style={{overflow: 'hidden', width: '100%', fontSize: '10px'}}
  dataSource={data.dataSource}
  columns={columns}
  size='small'
  bordered
  pagination={false}
/>

Also my table doesn't fit in the block.我的桌子也不适合这个街区。 Only 3 columns are displayed and the rest disappear.仅显示 3 列,rest 消失。 How can this be resolved?如何解决?

  • your-stylesheet.scss:你的样式表.scss:

    .ant-table table { font-size: 10px; .ant-table table { 字体大小:10px; } }

Here is the original answer you can use sass or less .这是您可以使用sass更少原始答案

    .booking_information_table {
        :global {
            .ant-table-thead > tr > th,
            .ant-table-tbody > tr > td {
                fontSize: '10px';
            }
    }

Secondly You can use the scroll property of Table and remove overflow: hidden其次,您可以使用 Table 的滚动属性并删除溢出:隐藏

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

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