这是我想要的:
这是我的结果:
我尝试将样式分配给我的输入 Prop ,但没有运气,有什么想法吗?谢谢。
<TextField
key={'verifyKey_'+i}
multiline={false}
InputProps={{
textAlign: 'center',
disableUnderline: true,
style: {
color: 'red',
textAlign: 'center'
}
}}
style={{
height: '50px',
width: '50px',
textAlign: 'center',
justifyContent: 'center'}}/>
最佳答案
使用 Flexbox 并将 textAlign: 'center'
替换为 alignItems: 'center'
:
{
height: '50px',
width: '50px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}
关于javascript - 在 mui 的文本字段上对齐文本中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52944369/