I have been trying to center an image(icon) inside of a button, which has worked for the most part. The image is centered inside of the button but whenever I scale the resolution down, the image clips outside of the button. Is there any way to solve this? Thanks for taking a look, I really appreciate this!
Tried to adjust the paddings of the button, worked with position absolute and center, even tried margin:auto
html
<figure>
<img class="imgpers" src="../media/opel/Adam.jpg" alt="Opel Adam">
<figcaption>naam: Opel Adam<br>prijs: 13.050,00<br>release date:</figcaption>
<button>
<img class="persButton" src="../media/favicon/Webp.net-resizeimage%20(1).png" alt="checkout">
</button>
</figure>
css
figure {
position:relative;
display: flex;
align-items: center;
background: #c9d0d4;
}
figure > button {
position: absolute;
right: 2%;
font-size: 36px;
background: dimgrey;
border: none;
width: 10%;
height: 25%;
}
.persButton {
position: center;
width: 20%;
height: 50%;
}
figcaption {
margin-left:3%;
color: #494949;
text-align: left;
font-size: 36px;
font-family:'Verdana', sans-serif;
}