Material-ui: 带有打字稿示例的React App中的字体太小

创建于 2018-03-05  ·  3评论  ·  资料来源: mui-org/material-ui

我的应用基于https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript

我试图包括非常基本的导航栏:

const styles: StyleRulesCallback<'root'> = theme => ({
  root: {
    textAlign: 'center',
    paddingTop: theme.spacing.unit * 20,
  },
});

class App extends React.Component<WithStyles<'root'>, {}> {

  render() {
    return (
      <div className={this.props.classes.root}>

          <AppBar>
            <Toolbar>
              <Typography variant="title" color="inherit">
                 Title
              </Typography>
            </Toolbar>
          </AppBar>

      </div>
    );
  }
}

export default withRoot(withStyles(styles)<{}>(App));

看来材料ui组件中的所有字体都很小。 按钮,选择打字错误。

例如,为什么我看到这个:
Imgur

而不是https://material-ui-next.com/demos/app-bar/

我的意思是为什么字体这么小?

image

question

最有用的评论

人们可以通过设置以下样式来禁用此可访问性行为:

html {
  font-size: 16px;
}

所有3条评论

Typography呈现的h2元素已将正确的font-size应用于该变体: 1.3125rem

作为字体大小的单位, rem是默认基本字体大小的倍数,通常为html元素定义。 检查您的文档,在html元素上是否定义了字体大小?

您可以在codeandbox

顺便说一句,这种类型的东西非常适合

我们将向您提供更多信息,但是乍一看,这对于Material-UI似乎不是问题。

人们可以通过设置以下样式来禁用此可访问性行为:

html {
  font-size: 16px;
}
此页面是否有帮助?
0 / 5 - 0 等级