I'm having problems finding the best way to position and size the image in the example here.
I want the image to be positioned on the far right and be resized so it fits inside the containing block.
Is position
the best way to position and how can I resize it to fit within the block. I want the image proportional scaled to fit
*{
font-family: sans-serif;
margin: 0;
padding: 0;
}
.block{
border: 1px solid grey;
margin: 10px;
position: relative;
}
.block__body{
padding: 10px ;
}
.block__img{
position: absolute;
right: 0;
top: 0;
}
<div class="block">
<div class="block__body">
<div>
<h3 class="block__heading">
Heading Text
</h3>
<p class="block__copy">Copy Text</p>
</div>
</div>
<div class="block__img">
<img
src="https://placeimg.com/640/480/animals"
alt="placeholder image"
/>
</div>
</div>