Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Center-align a Paper component inside a div

I can not center my <Paper> inside div. Please help

I locate <Paper> and <RaisedButton> inside div and gave with css:

.timerArea {
  text-align: center;
}

For Button it works but for Paper - no.

Style for <Paper>

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

Also my JSX:

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

and result on the image enter image description here

Thanks in advance.

like image 558
a.kozubenko Avatar asked Jul 30 '17 16:07

a.kozubenko


1 Answers

Try margin auto in paper style like this

const timeArea = {
  height: 150,
  width: 150,
  textAlign: 'center',
  rounded: true,
  paddingTop: 65,
  backgroundColor: '#76D8E3',
  opacity: 0.8,
  margin: auto,
};
like image 110
Prakash Sharma Avatar answered Sep 30 '22 18:09

Prakash Sharma