uniform column height in bootstrap

I've encountered an issue with the sizing of my React Social Card component. Despite trying to maintain consistency in size across all cards, the first one appears significantly larger than the rest. My limited familiarity with Bootstrap has hindered my efforts to address this discrepancy through CSS modifications. I sought assistance on Codesandbox by exporting the project from my Github repository; however, a frustrating error surfaced: "Error importing GitHub repository: Could not find package.json."

If anyone can offer guidance or a solution to this problem, please let me know. Below, I'll attach a screenshot for visual clarity along with snippets of the relevant components and CSS file. You can access the complete code on my Github repository via this link: https://github.com/jevoncochran/React-Social-Card

Here's the Cards component:

import React, { Component } from "react";
import Card from "./CardUI";

import img1 from "../assets/me-telice-pelo.jpg";
import img2 from "../assets/me-pernambues.jpg";
import img3 from "../assets/me-lucas-walking-pernambues.jpg";

class Cards extends Component {

    render() {
        return (
            <div className="container-fluid d-flex justify-content-center">
                <div className="row">
                    <div className="col-md-4">
                        <Card imgsrc={img1} title="Convergeance" />
                    </div>
                    <div className="col-md-4">
                        <Card imgsrc={img2} title="Continuation" />
                    </div>
                    <div className="col-md-4">
                        <Card imgsrc={img3} title="Conspiracy" />
                    </div>
                </div>
            </div>
        );
    }
}

export default Cards;

And here is the corresponding CSS:

body {
    background: radial-gradient(#e5e5e5, #ffff, #e5e5e5);
}

.card {
    width: 20rem;
}

.card:hover {
    box-shadow: 5px 10px 20px 1px rgba(0,0,0,0.253) !important;
}

.card-body {
    padding: 3rem 0 !important;
}

.card-text {
    font-size: 0.9rem;
    padding: 0.4rem 1.9rem;
}

.container-fluid .row {
    padding: 6rem;
}

.overflow { 
    overflow: hidden;
}

.card-img-top {
    transform: scale(1);
    transition: transform 0.5s ease;
}

.card-img-top:hover {
    transform: scale(1.4);
}

https://i.sstatic.net/c3d0q.jpg

Answer №1

After some investigation, I managed to find a workaround. Although it may not be the most optimal solution available, I identified that the issue stemmed from the first image being larger than the other two images. To rectify this, I adjusted my CSS code to limit the maximum height of all images to match the size of the last two (211.938px).

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

Looking for a way to implement a functionality similar to setFieldError in Antdesign for Reactjs

I am currently attempting to manually change a field to an error or warning state after the form has been submitted. However, I am unable to locate a function similar to setFieldError on the form hook. In the image provided, my goal is to set the email f ...

How can I use npm to generate and package an Apollo GraphQL server application?

Seeking advice on the npm command needed to build and package an Apollo Grapphql server application. Currently using nodemon start command to run the application, but looking to create a package and publish it on the server. Which specific npm command shou ...

Trouble accessing state when React child calls parent method

Within my project, I am working with 3 components that are nested as follows: App->GameList->GameItem The App (parent) component has a method that is triggered by the onClick event within the GameItem (child) component Upon clicking the GameItem co ...

Fully conceal a DIV while the webpage is loading

Following the header, I've implemented a hidden div with a height transition that can be activated by a button. However, there seems to be an issue where the browser displays the content of the div while the page is loading and then hides it afterward ...

Attempting to initiate a CSS animation by clicking a button using JavaScript

I'm having trouble getting a CSS animation to trigger with a button press using Javascript. I've gone through various questions and answers, but nothing seems to work. My code looks like it should do the trick -- what am I missing? When I click t ...

Tips for preventing key/id issues in ReactJS and effectively passing props down from parent to child components

I keep encountering an obstacle when attempting to pass parent data down to the child component. Here is how I am approaching it: <%= react_component 'Items', { data: @items } %> Within my Items component, I make an ajax call, set state, ...

When attempting to access front-end SPA links through the browser, the back-end triggers an error due to not being

My front-end single-page-application is built using JS (ReactJS), and the back-end is running on Phoenix (Elixir). Everything functions smoothly within the application, but I encounter a route error from Phoenix when attempting to access a page in the SPA ...

Is it possible to create a data structure that enforces specific keys and values types during initialization?

When styling react components with MaterialUI's sx property, I've found that keeping the full style definition inline can lead to cluttered and overwhelming component bodies. To combat this, I've moved all the style definitions into a consta ...

Bootstrap 3's Clear:Left Media Query Feature

Bootstrap is being used, and there is a div with col-xs-12, col-sm-6, col-md-4 classes. Task : To add a clear on every 1 item for col-xs-12, add a clear on every 2 items for col-sm-6, and clear on every 3rd item for col-md-4. The current code only s ...

Embracing Efficiency with Asynchronous Requests in a React Redux App Utilizing Redux Thunk

Challenge I am currently facing a dilemma in implementing an AJAX request that needs to be triggered by various UI elements on a webpage. The AJAX request is consistently directed towards the same endpoint and always sends identical properties from the re ...

picker and calculator for selecting date ranges

I'm currently working on a hotel booking form where prices are calculated based on the number of adults, seniors, and students. I'm trying to add a date range picker feature that will determine the total cost depending on the selected number of d ...

CSS and Jquery HTML linking

Every time I update the HTML of an element dynamically using jquery.html(), the external CSS styles (except for those inherited from parent elements) are not applied to the elements. When I refer to external CSS, I am talking about styles that are not dire ...

What is the best way to transform a string into React components that can be displayed on the screen?

Stored in my database are strings that contain partial HTML content, as shown below: “Intro<br /><br />Paragraph 1<br /><br />Paragraph 2” If I want to display this string within a new <p> element, what is a straightforwa ...

CSS for Mobile Devices: How to Properly Position Backgrounds

My website has an image named background.jpg that displays correctly on desktop but looks odd on mobile screen sizes. How can I modify my stylesheet.css to reduce the size of the image so it appears similar to how it does on desktop? Current code: #servi ...

The Box element surpasses the height of the Grid component

Homepage Component <Box component="fieldset" sx={{borderRadius:2, height:"100%"}}> Application Structure Component <Grid container> <Grid item xs={4} > <Root/> </Grid> ...

The JSX.Element cannot be assigned to a parameter of type ForwardRefRenderFunction

I am facing an issue while trying to export a React component and encountering a TypeScript error that I cannot seem to resolve. Here is the code for the component: import React, { useEffect, MutableRefObject, forwardRef, RefObject } from 're ...

The immutability of the List in JavaScript and its

I am confused about how the size of an Immutable JS List grows. According to the official documentation example at https://facebook.github.io/immutable-js/docs/#/List/push, pushing something into an immutable js List should automatically increase its size ...

Error: Attempting to access 'jquery' property on undefined object is not allowed

When using [email protected] in my React JS application, I encountered this error message. Even after installing jQuery and importing the Bootstrap bundle as shown below: import "bootstrap/dist/js/bootstrap.bundle"; I still received the fo ...

Tips for deleting a chunk in Next.js

Currently, I am involved in a Next.js and Reactjs project. In an effort to optimize performance and address Lighthouse recommendations regarding unused JS files, I am exploring the possibility of removing chunk js files from the _next/static/chunks direc ...

Troubleshooting Printing Issues on WordPress

After conducting a thorough search on Google to find solutions for this issue, I discovered that most of the fixes are specific to certain themes. While I did come across a suggestion to create a print.css file which partially solved the problem by printin ...