I am a relative newbie to HTML and CSS/Flex, so bear with me and thanks for any help with this problem. I am trying to get character avatars as an image on the sheet, which is using CSS-Grid and Flex However the image, while centred, can 'spill-over' the grid area. My goal is to have the image keep its aspect ratio but otherwise be contained within the grid area. So the below image shows the current state: the HTML for the section with the avatar image is (not sure if div is needed but) <section class="common">
<div class="image">
<img alt="Character Avatar" name="attr_character_avatar"/>
</div>
</section> and for the CSS .common {
grid-area: common;
background-color: white;
display: flex;
justify-content: center;
align-items: center;
}