Setting cards to have the same height in a Vue JS card set

Here is a card component example:

<div
      name="card container"
      class="flex max-w-[25vw] flex-grow flex-col gap-3 rounded-xl border-2 border-green-600 transition-all duration-500 hover:scale-105"
    >
      <div name="image" class="flex h-[30vh] justify-center p-2 align-middle">
        <img :src="getImageUrl()" :alt="imageDesc" />
      </div>
      <div
        name="web architecture"
        class="ml-3 w-fit rounded-3xl border-2 px-3 font-semibold"
        :class="templateColor"
      >
        {{ webArchitecture }}
      </div>
      <div
        name="card title"
        class="flex-grow-1 border-2 border-blue-600 text-center text-xl font-bold"
      >
        {{ title }}
      </div>

      <div
        name="card description"
        class="flex h-fit justify-center overflow-y-auto border-2 border-red-600 p-4 text-center align-middle font-semibold text-gray-500"
      >
        {{ description }}
      </div>
</div>

I then imported this card component into another container and used it:

<div
    class="flex-0 container mx-auto mt-5 flex items-stretch justify-center gap-5 rounded-xl border-2 border-purple-600 p-5"

... multiple cards components...

</div>

The issue I am facing is that the cards do not have the same height. I have tried using flex-grow, overflow-y-auto, and other methods but nothing seems to work. Does anyone have any suggestions on how to make them equal in height?

Answer №1

Take a look at https://play.tailwindcss.com/AoGooIJ9CT (Solution)

<div class="flex-0 container mx-auto mt-5 flex items-start justify-center gap-5 rounded-xl border-2 border-purple-600 p-5">
  <div name="card container" class="flex max-w-[25vw] flex-grow flex-col gap-3 rounded-xl border-2 border-green-600 transition-all duration-500 hover:scale-105">
    <div name="image" class="flex h-[30vh] justify-center p-2 align-middle">
      <img :src="getImageUrl()" :alt="imageDesc" />
    </div>
    <div name="web architecture" class="ml-3 w-fit rounded-3xl border-2 px-3 font-semibold" :class="templateColor">{{ webArchitecture }}</div>
    <div name="card title" class="flex-grow-1 border-2 border-blue-600 text-center text-xl font-bold">{{ title }}</div>

    <div name="card description" class="flex h-fit justify-center overflow-y-auto border-2 border-red-600 p-4 text-center align-middle font-semibold text-gray-500">{{ description }}</div>
  </div>
  <div name="card container" class="flex max-w-[25vw] flex-grow flex-col gap-3 rounded-xl border-2 border-green-600 transition-all duration-500 hover:scale-105">
    <div name="image" class="flex h-[30vh] justify-center p-2 align-middle">
      <img :src="getImageUrl()" :alt="imageDesc" />
    </div>
    <div name="web architecture" class="ml-3 w-fit rounded-3xl border-2 px-3 font-semibold" :class="templateColor">{{ webArchitecture }}</div>
    <div name="card title" class="flex-grow-1 border-2 border-blue-600 text-center text-xl font-bold">{{ title }}</div>

    <div name="card description" class="flex h-fit justify-center border-2 border-red-600 p-4 text-center align-middle font-semibold text-gray-500">{{ descriptio sfaf safdafaf ssdfsgf sdgsdgf sdfsgsf sdgsdf sdgsfsdgfsdgfsdfsgf }}</div>
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to format a pseudo-element to serve as the header for a paragraph?

We are utilizing Markdown (Kramdown) for generating a static website. When incorporating infoboxes, we can enhance paragraphs and achieve the following outcomes: {:.note .icon-check title="This is a title"} Lorem, ipsum dolor sit amet consectetur adipisici ...

What is the best method for enlarging the central image in Owl Carousel?

Could someone help me with implementing Owl Carousel to achieve this design? I have attempted it, but unfortunately, it is not working as expected. Your assistance in fixing the issue would be greatly appreciated. Please find the necessary code below: ...

Error occurs when using Express.js in combination with linting

https://www.youtube.com/watch?v=Fa4cRMaTDUI I am currently following a tutorial and attempting to replicate everything the author is doing. At 19:00 into the video, he sets up a project using vue.js and express.js. He begins by creating a folder named &apo ...

Tips for making Slider display the next or previous slide when span is clicked

I have implemented a mix of bootstrap 3 and manual coding for my project. While the image thumbnails function correctly when clicked, the span arrows do not navigate to the next or previous images as intended. Below is the code snippet: var maximages ...

On smaller screens in portrait mode, CSS automatically incorporates margin adjustments

Here is the code I am working with: <html> <head> <style> body { margin: auto; width: 720px; } </style> </head> <body> <p>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ip ...

What is the equal tr of CSS?

Is there a way to separate the menu bar from the body within a div, so that everything after 'contact' appears below it? Is there a specific code or command similar to a newline that can achieve this? Your help is greatly appreciated :) Thank you ...

Expanding images using basic HTML techniques

Current Situation: In the process of developing an application that involves setting a background image, I aim to make it compatible with mobile, desktop, and tablet devices. Query: I am seeking advice on the most effective method to stretch and display ...

Tips on adjusting my script to focus on particular text within a div in HTML

I'm currently learning how to code and working on a text generator that allows users to edit text and export it as .DOCX. I came across this script called jsfiddl on the website npmjs, which enables exporting HTML to .DOCX. However, I'm having tr ...

Error message displayed: "An error occurred while processing the VueJS InertiaJS Uncaught (in promise) TypeError. It seems that the property 'search'

Currently, I am working on a Vue JS project with Inertia. One of the features I am implementing is a list that allows users to filter by name. data() { return { selectedUser: this.value, selected: null, search: & ...

What is the best location to insert Google Search description in a VUE application?

We have successfully created a Vue application that supports multiple languages by utilizing i18n dictionaries. In addition, we have included descriptions in the "/public/index.html" file for Google search page visibility using meta tags: <meta proper ...

Creating a link button using JavaScript

I have integrated a Setmore code on my website to facilitate appointment booking, which triggers a popup similar to what you would see on a hotel reservation site. <script id="setmore_script" type="text/javascript" src="https://my.setmore.com/js/iframe ...

I am looking to have two elements positioned next to each other in equal dimensions, such as the reCaptcha feature

Could someone assist me in positioning these elements side by side, each taking up 50% of the screen? I'm unsure if this can be achieved while using the reCaptcha iFrame. <div class="g-recaptcha" data-sitekey="sitekey" style="transform:scale(0.5); ...

Utilizing the background-size property for image styling within the img tag

html <div> <img src="http://www.hdwallpapersplus.com/wp-content/uploads/2013/06/abstract_color_background_picture_8016-wide.jpg" /> </div> css div{ width: 200px; height: 100px; background-color: red; } img{ position: re ...

Is it possible to decrease the HTML font size when making the website responsive?

I made the entire website using rem units due to utilizing the bootstrap 4 alpha version. Now, I am ready to begin the responsive design of the site. My html {font-size: 16px} declaration is set, so I am wondering if I can adjust the size of html in the m ...

"Embracing the power of dynamic CSS customization within Umbraco

I recently inherited an Umbraco system without much prior knowledge of the platform, and I am currently investigating the site's performance. The branding and styling of the site is currently managed through a "Brand" document type, allowing the site ...

Incorporating Google Maps into a unique custom shape div

Looking to create a unique shaped div that will house a Google Maps map. I have the custom border covered with a .png, but creating the actual shape is where I'm stuck. I believe using HTML canvas may be the solution, along with CSS overflow:hidden to ...

Elements that do not change when hovered over and that intersect

In the provided example, I am attempting to decrease the opacity of non-hover elements on an HTML page. The code snippet below successfully reduces the opacity of non-overlapping elements. However, when there is a background element that overlaps and shou ...

Footnotes integrated directly into the text using only HTML and CSS (in-line notations?)

Instead of appearing below or alongside the main content, notes on FiveThirtyEight expand within or below the paragraph when the note tag is clicked. They could be referred to as "in-notes" instead of footnotes. I personally find this system very efficien ...

Make the navigation bar stay at the top of the page when scrolling past another element with a top position of 100vh

Trying to explain a unique concept here. I want a nav bar fixed in the position of top:100vh, so that as I scroll down and reach the next section, the navbar sticks at the top rather than staying stuck at the beginning with position:fixed top:0. The aim is ...

Issue with Bootstrap 5.3 (Column alignment problem)

The issue at hand is the misalignment of the three columns. The code snippet providing more insight into this problem can be found below. Click here to view image description Or click here for another image description This alignment problem persists ev ...