2017-07-30 50 views
0

我无法将我的<Paper>居中放在div中。请帮助text-align for material ui

我找到<Paper><RaisedButton>内股利和使用CSS给:

.timerArea { 
    text-align: center; 
} 

对于按钮,它的作品,但对于纸 - 没有。

风格<Paper>

const timeArea = { 
    height: 150, 
    width: 150, 
    textAlign: 'center', 
    rounded: true, 
    paddingTop: 65, 
    backgroundColor: '#76D8E3', 
    opacity: 0.8 
}; 

而且我的JSX:

<div className={styles.timerArea}> 
    <Paper style={timeArea} zDepth={1} circle>{stopWatchTime}</Paper> 
    <RaisedButton onClick={buttonRole} backgroundColor={buttonColor}>{buttonName}</RaisedButton> 
</div> 

,并在图像上导致提前enter image description here

感谢。在纸风格

+0

尝试“保证金:汽车”纸风格 –

+0

感谢,它的工作原理。 请将它写为答案,我将其标记为有用 –

回答

1

尝试缘汽车这样

const timeArea = { 
    height: 150, 
    width: 150, 
    textAlign: 'center', 
    rounded: true, 
    paddingTop: 65, 
    backgroundColor: '#76D8E3', 
    opacity: 0.8, 
    margin: auto, 
};