How is assigning a value to width also affecting the height of the image in this case??
.card{
width: 22%;
padding: 1.5%;
height:300px;
float: left;
text-align: center;
}
.card img{
width:100%;
}
Code for HTML
<div class="card-list">
<h1 id="product">Products</h1>
<div class="card">
<img src="assets\coffeecards\americano-image.png">
<div>
<h2>Americano</h2>
<h3> ₹ 250</h3>
</div>
</div>
</div>
when width is given 50%
The height also seems to automatically get adjusted.