I am currently working on a memory card game using HTML, CSS, and JS as part of my practice. You can check out what I have accomplished so far right here: . Upon inspection, you may notice that the images of the question mark and the flipped card are slightly stretched in the game. Here is the CSS code I am using:
.memory-game {
width: 640px;
height: 640px;
margin: auto;
display: flex;
flex-wrap: wrap;
perspective: 1000px;
}
.memory-card {
width: calc(25% - 10px);
height: calc(33.333% - 10px);
margin: 1px;
position: relative;
transform: scale(1);
transform-style: preserve-3d;
transition: transform .5s;
box-shadow: 1px 1px 1px rgba(0,0,0,.3);
}
The memory-card
is nested within the memory-game
container. How can I go about fixing the stretched images? Is it a matter of adjusting the HTML structure, tweaking the CSS code, or should I consider cropping the images to a specific ratio?
Any insight or guidance you could provide would be greatly appreciated.