I'm using react and react-chartjs-2 so I think posting the markup would over complicate the question. But at a high level, the layout looks like this
<div class="parent">
<div class="percent">80%</div>
<div class="pie-chart">...</div>
</div>
css
.parent {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
result
The issue is that display flex is centering both children together. Is it possible to tell .percent
to be centered within .parent
without taking .pie-chart
into consideration?