The layout of the page looks like this:
https://i.sstatic.net/NGCNP.png
I am trying to center the Redbox (containing '1') within the "PlayerOneDiv".
Similarly, I want to center the yellow box within "PlayerTwoDiv".
return (<div className="App">
<div className="sampleDiv" onClick={getData}>
<div className="playerOneScoreDiv">1</div>
<div className="midDiv">
<Box param={pitValue1} funcParam={getData}> b</Box>
</div>
<div className="playerTwoScoreDiv">3</div>
</div>
The styling for PlayerOneDiv and the outer div is as follows:
.sampleDiv {
background-color: green;
margin: auto;
width: 60%;
padding: 100px;
border-radius: 14px;
display: flex;
flex-direction: row;
}
.playerOneScoreDiv {
width: 15%;
height: 96px;
display: flex;
align-items: center;
justify-content: center;
font-size: 3rem;
font-weight: bold;
border-radius: 14px;
color: #fff;
margin-right: 4px;
margin-bottom: 4px;
cursor: default;
background-color: red;
}
Even though the number "1" in PlayerOneDiv shifts properly, the entire box does not center within the div.
Which CSS property should I adjust or should I introduce an additional wrapper div?