Guide to ensuring uniform card height in Bootstrap 4

Struggling with creating cards of equal size.

I have been trying different solutions like using h-xxx, align-items-stretch, and Height:100% but still unable to make my cards have the same size or height in this case.

This is my current code:

  <div class="content">
    <div class="container-fluid" style=" height:360px">

      <div class="row align-items-stretch ">
        <!-- PROJECT DETAILS -->

        <div class="card h-100 w-40 ml-3" id="details" *ngFor="let c of projectf">
            <div class="card-header" align="center">
                <h4 class="title">{{c.projectname}}</h4>
              </div>


          <div class="container ">
            <div class="row">
              
               <!-- More HTML code here -->
            

  

              <div class="form-group col-md-6">
                <label for="FechaIP">Start Date</label>
                <input type="text" value="{{c.startdate | date: 'yyyy-MM-dd'}}" class="form-control btn-outline-secondary"
                  disabled id="StartDate">
              </div>
              <div class="form-group col-md-6">
                <label for="FechaCP">End Date</label>
                <input type="text" value="{{c.enddate | date: 'yyyy-MM-dd'}}" class="form-control btn-outline-secondary"
                  disabled id="EndDate">
              </div>
            </div>

            <div class="row justify-content-center">
              <div class="form-group  ">
                <label>Platform</label><br />
                <select class="btn btn-outline-secondary" disabled style="border-color:rgba(165, 157, 157, 0.664)">
                  <option *ngIf="c.type=='USSD'" value="1">USSD</option>
                  <option *ngIf="c.type=='SMS'" value="1">SMS</option>
                </select>
              </div>
            </div>

          </div>
        </div>

        <!-- TEST CASES-->


        <div class="card h-100 ml-3 d-flex " id="card">
          <div class="card-header" align="center">
            <p class="text-muted">Created Test Cases</p>
          </div>
         

          <div id="table" class="table-responsive text-nowrap" style="overflow:auto;">

            <table class="table table-hover">

               <!-- Table content -->

               </tbody></table>

          </div>`;

When I add more items to my table, it starts to grow and exceed the height of the left card. If I set a static height, the card loses its responsive feature

Answer №1

It seems that the best approach in this scenario would be to establish a fixed height, such as: height: 500px or 50vh.

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<style>
  .align-items-stretch.row {
   height: 50vh;
  }
</style>
<div class="content">
    <div class="container-fluid" style="height:360px">
        ... (remaining code) ...
    </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

Ways to Toggle div Visibility for Elements with Identical Class Names on an Individual Basis

After searching for solutions on stackoverflow, I attempted to implement some answers provided by other users, but I'm still not achieving the desired outcome. In my website's about section, there are four different items. When a specific item&a ...

What's the best way to horizontally align two logos in the navigation bar?

Has anyone successfully placed 2 logos on the navbar in Materialize Framework side by side? I'm struggling to make it work and could use some help. Here is my CodePen for reference. I've experimented with the display property but haven't ...

Guide on utilizing Subscribe Observable for performing lookup in Angular

I am new to Angular and seeking guidance as my approach may not be the best. Please advise me on a better solution if you have one. My goal is to display a list of records in table format, retrieved from the database where only Foreign Keys IDs are availa ...

Methods for concealing the title and date when printing web content using JavaScript

When utilizing the window.print method to print out a specific screen, I encountered an issue. I need to hide the date in the top left corner of the image as well as the title (not the big heading) which has been intentionally blurred. I've come acro ...

How to efficiently filter an array containing nested objects using TypeScript

I'm currently working with a list of menus and submenus: [ { "NUA_ID_Menu": 1, "TXT_Nom_Menu": "Menu 1", "Liste_Sous_Menus": [ { "TXT_Nom_Menu": ...

Design the title attribute for the style area tag

Currently, I have set up an image with various clickable areas on it, and I want to display a description when the user hovers over these areas. My current solution involves adding the descriptions as titles, but I feel like there might be a better way to ...

How do rxjs Subjects and EventEmitters impact the performance of an Angular application?

I'm currently working on passing an event to a child component from the parent element. This is how my code structure looks: Parent Component HTML: ... <child-component [validate]="emitValidateAsObservable"> <child-component [validate]="em ...

Creating QR codes from raw byte data in TypeScript and Angular

I have developed a basic web application that fetches codes from an endpoint and generates a key, which is then used to create a QR Code. The key is in the form of an Uint8Array that needs to be converted into a QR Code. I am utilizing the angularx-qrcode ...

What is the best way to securely store a JWT Token received from Cognito after logging in through the Cognito Hosted UI?

Our current architecture involves front end Angular and backend nodejs/express. This setup functions in the following order: User logs in to the site via Cognito Hosted UI Upon successful login, the user is redirected to our home page with a code sent in ...

Unable to compile angular project - Encountering Error - The data path ".builders['app-shell']" must contain the mandatory property 'class'

While attempting to construct an angular project, I encountered the following error: Data path ".builders['app-shell']" should have the required property 'class'. Error: Schema validation has failed with the errors noted below: Data pa ...

Error encountered while trying to import a bootstrap file into a component

I am facing an issue in my Angular project where I have locally downloaded Bootstrap and trying to reference the _variables.scss file inside a component. However, whenever I import it into the component, I encounter a compile error. Is there a mistake in m ...

Struggling with the alignment of divs in a vertical manner

Looking for a way to align multiple divs inside another div vertically with even spacing between them? They should all start at the top. Currently, my solution has the child-divs positioned at the top-left corner of the parent div (see the first picture): ...

Encountering the error message "TypeError: this.http.post(...).map is not a function" after upgrading from Angular 5 to Angular

I encountered some issues with rxjs6 after upgrading from Angular 5 to Angular 6: TypeError: this.http.post(...).map is not a function error TS2339: Property 'map' does not exist on type 'Observable<Object>'. TypeError: rxjs__W ...

Making a readonly input appear like a div using css

Is there a way to style a readonly input to look like a block level element while maintaining its automatic width adjustment? Setting the width to 100% is not the desired solution. Here is the CSS code that I have tried: input:read-only, textarea:read-on ...

Modifying the onclick event of a button: A guide

Once a user selects the Add button located below the photo, that specific image is to be appended to the table adjacent to the list and subsequently transforms the add button into a REMOVE button. eg. Current status: https://i.stack.imgur.com/8eJoS.png ...

How to center a container in HTML using Bootstrap techniques

Here is the code I have been working on: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/> <div class="span4 offset4 centered"> <div class="container overflow-hidden"> < ...

Following the upgrade to version 6.3.3, an error appeared in the pipe() function stating TS2557: Expected 0 or more arguments, but received 1 or more

I need some assistance with rxjs 6.3.3 as I am encountering TS2557: Expected at least 0 arguments, but got 1 or more. let currentPath; const pipeArgs = path .map((subPath: string, index: number) => [ flatMap((href: string) => { con ...

The identical web address functions as a point of reference for design, however it does not function as an AJAX request

This piece of code is functioning properly: {html} {head> {**link rel="stylesheet" href="http://localhost:3000/CSS/mystyle.css"**} {/head} {body} {/body} {/html} However, when I use the same URL in this ...

Steps to apply styles to an iframe element directly from its inner HTML code

Looking for help with this line of code: <iframe src="http://www.google.com" name="google" style="Z-INDEX: 0; MARGIN-TOP: -1px; WIDTH: 100%; HEIGHT: 1070px"> <html> <head></head> <body> < ...

Utilizing a library that solely enhances the functionality of the Array object

I have a library with type definitions structured like this: declare global { interface Array<T> { addRange<T>(elements: T[]): void; aggregate<U>(accumulator: (accum: U, value?: T, index?: number, list?: T[]) => an ...