I have developed several products using only HTML & CSS.
One challenge I am encountering is that when the content inside the div exceeds a certain length, it causes everything to shift down, resulting in uneven alignment (refer to the 3rd product in the image). Is there a way for me to ensure everything stays aligned?
My idea is to give the h2 tag enough space to accommodate 2 or 3 lines of text (as my products are not longer than 2 lines). This would keep the "read more," grams, and button elements fixed and inline.
Do you have any suggestions on how I can achieve this alignment, or any recommendations? I have provided the Codepen link, code snippet, and image for your reference.
/* Your CSS code here */
<body>
<div class="container">
<section class="cards">
<!-- card 1 -->
<article class="card">
<picture class="thumbnail">
<img class="" src="image-url-here" alt="" />
</picture>
<div class="card-content">
<h2>Product Name</h2>
<a href="" class="read_more">Read More</a>
<p class="product_grams">80g</p>
<button type="submit" class="btn">Add</button>
</div>
</article>
<!-- Repeat this structure for other cards -->
</section>
</div>
</body>