I want to align the text over an image to the center which I managed to do, but I am not sure how I can center the image(with centered text in it) to the top center of the grid cell. This is the output I have:
And this is my code:
.inner-nested div.inner-four{
grid-column: 2/3;
grid-row:1/2;
display: flex;
font-family: 'Roboto', sans-serif;
color: white;
position: relative;
text-align: center;
margin: auto;
}
.nested div.inner-four img{
flex-direction: column;
align-items: center;
}
.inner-nested div.inner-four div.percentage{
position: absolute;
margin: auto;
top: 10px;
left:0;
right:0;
bottom:0;
color:white;
font-family: 'Roboto', sans-serif;
font-size: 30px;
margin-top: auto;
}
<div class="inner-four">
<img src="Pictures/shape.svg" style="height: 80px; width: 80px;">
<div class="percentage">-50%</div>
</div>