我的应用基于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组件中的所有字体都很小。 按钮,选择打字错误。
例如,为什么我看到这个:
而不是https://material-ui-next.com/demos/app-bar/
我的意思是为什么字体这么小?
Typography呈现的h2
元素已将正确的font-size
应用于该变体: 1.3125rem
。
作为字体大小的单位, rem
是默认基本字体大小的倍数,通常为html
元素定义。 检查您的文档,在html
元素上是否定义了字体大小?
您可以在codeandbox中
顺便说一句,这种类型的东西非常适合
我们将向您提供更多信息,但是乍一看,这对于Material-UI似乎不是问题。
人们可以通过设置以下样式来禁用此可访问性行为:
html {
font-size: 16px;
}
最有用的评论
人们可以通过设置以下样式来禁用此可访问性行为: