如何增加表格组件的字体大小

如何增加表格组件的字体大小

本文介绍了如何增加表格组件的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始评估material-ui作为项目的替代方案,我想知道改变表字体大小的推荐方法.

I'm beginning to evaluate material-ui as an alternative for a project and I would like to know what is the recommended way to change the font size for a table.

当前,我正在使用组件的沙箱(可从 https://codesandbox.io/s/9onokxxn5w获得),但我找不到为了扩大字体大小而要更改的内容.

Currently I'm playing with the component's sandbox (available at https://codesandbox.io/s/9onokxxn5w) but I couldn't find what to change in order to enlarge the font size.

我试图更改demo.js中的主题,如下所示,向table元素添加了fontSize键,但是没有用:

I tried to change the theme in demo.js adding a fontSize key to the table element, as follows, but it didn't work:

const styles = theme => ({
    root: {
        width: '100%',
        marginTop: theme.spacing.unit * 3,
        overflowX: 'auto',
    },
    table: {
        minWidth: 700,
        fontSize: '40pt'
    },
});

在此情况下,感谢您提供任何帮助.

Thanks in advance for any help in figuring this out.

推荐答案

似乎不适用于Table,但适用于TabelRow或TableCell.在TableRow元素中添加一个类,并在其上设置fontSize参数

It seems that it does not work for Table but it works for the TabelRow or for the TableCell.Add a class to the TableRow element and set the fontSize param on it

...
<TableRow key={n.id} className={classes.tablecell}>
...

 const styles = theme => ({
        root: {
            width: '100%',
            marginTop: theme.spacing.unit * 3,
            overflowX: 'auto',
        },
        table: {
            minWidth: 700
        },
        tablecell: {,
            fontSize: '40pt'
        }
    });

这篇关于如何增加表格组件的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 09:00