我正在努力制作更易访问的网页。但是,当我将页面变得更宽时,元素似乎会向下重新定位。我认为这是因为我基于百分比而不是固定值设置了上边距。我不确定为什么在屏幕变宽时高度会增加。当使用flexGrow时,高度和宽度是否设置为固定比例?
我正在使用material-ui和以下样式覆盖:
const styles = theme => ({
root : {
flexGrow: 1,
height: '100%',
width: '100%',
display: 'flex',
justifyContent: 'center',
backgroundColor: 'green'
},
form: {
backgroundColor: 'grey',
width: '75%',
display: 'flex',
flexDirection: 'column',
marginTop: '40%',
marginBottom: '50%',
padding: 20,
paddingTop: 35,
minHeight: 200,
},
})
以下是我正在使用的表单元素:
<div className={classes.root}>
<form className={classes.form} onSubmit={this.login}>
<Typography component="h2" variant="headline">Login</Typography>
</form>
</div>
我希望当表单宽度增加时,表单高度能保持不变,但实际并非如此。