Differentiating card heights on hover in bootstrap can be achieved by adjusting the CSS properties specifically for each card

I'm currently working with bootstrap cards and have added hover effects to them. However, I'm facing an issue where on larger devices, hovering over one card enlarges all the other cards as well. This problem doesn't occur on smaller devices. My desired outcome is that only the card being hovered over should enlarge, while the rest remain the same size. Feel free to try the snippet below in full screen mode to see the issue for yourself.

.card{
            cursor: pointer;
            transition: all 0.5s ease-out;
        }
        .content{
            max-height: 0;
            transition: max-height 0.15s ease-out;
            overflow: hidden;
        }

        .content .copy{
            max-height: 0;
            transition: max-height 0.15s ease-out;
            overflow: hidden;
        }
        .card-footer{
            max-height: 0;
            transition: max-height 0.15s ease-out;
            overflow: hidden;
            border:none !important;
        }
        .card-header{
            display: block;
            border:none !important;
            padding-top: 20px;
            padding-bottom: 20px;
            transition: all 0.5s ease-out;
            transition: border 0.15s ease-out;
            overflow: hidden;
        }
        /* adding hover */
        .card:hover{
            box-shadow: 0px 0px 10px 0px rgb(86 82 90 / 35%) !important;
        }
        .card:hover .content{
            max-height: 500px;
            transition: max-height 0.25s ease-in;
        }

        .card:hover .copy{
            max-height: 500px;
            transition: max-height 0.25s ease-in;
        }
        .card:hover .card-footer{
            max-height: 500px;
            transition: max-height 0.25s ease-in;
            border-top: 1px solid #d7dae3;
        }

        .card:hover .card-header{
            display: block;
            border-bottom: 1px solid #d7dae3;
            transition: border 0.25s ease-in;
        }
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="debcb1b1aaadaaacbfae9eebf0eef0ef">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
                <div class="row">
                    <div class="col-xl-4">
                        <div class="card shadow-sm p-4">
                            <div class="card-header p-0 text-center">
                                <h2 class="title">Card 1</h2>
                            </div>
                            <div class="content text-break p-2">
                                <p class="copy">card-1 description</p>
                            </div>
                            <div class="card-footer text-left p-0">
                                <button class="btn btn-primary m-3">View</button>
                            </div>
                        </div>
                    </div>

                    <!-- end cards -->
                    <div class="col-xl-4">
                        <div class="card shadow-sm p-4">
                            <div class="card-header p-0 text-center">
                                <h2 class="title">Card 1</h2>
                            </div>
                            <div class="content text-break p-2">
                                <p class="copy">card-1 description</p>
                            </div>
                            <div class="card-footer text-left p-0">
                                <button class="btn btn-primary m-3">View</button>
                            </div>
                        </div>
                    </div>

                    <!-- end cards -->
                    <div class="col-xl-4">
                        <div class="card shadow-sm p-4">
                            <div class="card-header p-0 text-center">
                                <h2 class="title">Card 1</h2>
                            </div>
                            <div class="content text-break p-2">
                                <p class="copy">card-1 description</p>
                            </div>
                            <div class="card-footer text-left p-0">
                                <button class="btn btn-primary m-3">View</button>
                            </div>
                        </div>
                    </div>

                    <!-- end cards -->
                </div>
            </div>

Answer №1

The code snippet is now functioning perfectly.

This issue seems to be isolated to IOS users, as I have experienced it before when aligning images with flexbox.

It appears that IOS and Windows may have different default behaviors for flexbox in certain situations.

For instance, IOS expects boxes to align their heights, while Android and Windows do not adjust the heights automatically. Essentially, this could be considered as using `flex-start`.

Due to these discrepancies between devices, we must explicitly define how we want the layout to behave when the height changes.

Bootstrap offers a solution in the form of a class: .align-items-start.

.align-items-start

Remember to apply this class to the following element:

<div class="row align-items-start">

Keep in mind that this solution is theoretical and may not work in all cases. However, the provided example is currently functional.

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

"Error: The function $(...).autocomplete is not recognized" in conjunction with Oracle Apex

Currently experiencing some frustration trying to solve the issue at hand. The Uncaught TypeError: $(...).autocomplete is not a function error keeps popping up and I have exhausted all resources on Stack Overflow in an attempt to fix it. This problem is oc ...

Troubleshooting Issue: Minified CSS in Vue.js not displaying correctly when deployed on Azure static website

I have successfully deployed a static vue.js website to Azure at The development build looks great in Chrome and Safari on OS X, and the production build works fine when served from the dist directory. However, the CSS doesn't seem to be rendering c ...

Creating a default homepage across various HTML files using Google Apps Script and deploying it as a WebApp

Is there a way to set a default main page on multiple HTML and GS files in Google AppScript? I plan to publish it as a Web App. Have you attempted using the doGet function? ...

Mastering the art of column stacking with CSS on your WordPress website

Looking for a CSS solution to adjust the layout when the screen resolution is lowered. Currently, I have two rows with three columns in each row, containing blurbs. My goal is to make these two rows convert into three rows with two columns each at a cert ...

Creating an Interactive Menu System with Nested Options in Angular 2

I have a JSON structure that I need to transform into a menu with sub-menus based on the value of the sub-menu_location field. Here's an example: { "data": [ { "menu_name": "Primary Operations", "enabled": true, "sub-menu_lo ...

Sending information via HTML on an iPhone

Posting form data on a website typically involves using the following HTML code with a post request: <div id="requestinfo"> <form method="post" action="http://abc/form-post.php" id="request_form"> <input type="hidden" name="fiel ...

Is there a restriction on the maximum size of a CSS file?

Currently, I am working on building a site using ASP.NET MVC. The CSS file that I have been working on has now grown to 88KB in size and contains over 5,000 lines of code. Recently, I have noticed that some styles that I added towards the end of the file a ...

What is the process for populating the Body placeholder in asp.net Core MVC?

After reviewing a tutorial, I discovered that the RenderBody method is supposed to display views within the designated placeholder of the layout, as illustrated in this diagram: https://i.sstatic.net/nJLUm.png However, in practice, it did not work exactl ...

Elements of <nav> within a <footer> section

I've recently started using HTML5 display elements like header, footer, and nav. While reading about the nav element in particular, I found this interesting information in the HTML5 spec: The nav element is primarily intended for major navigation b ...

What is the best way to retrieve the href and id values dynamically from a card in React JS?

Hello everyone, I'm new to stackoverflow and still in the process of learning how to code. Please bear with me if this question sounds like a newbie one. My question is about having dynamic values for href and id when mapping data using axios to crea ...

Is there a way to develop a login form that retrieves information from a Google Sheet database?

Please help me with a solution. I have developed a registration form which effectively saves users' information in a Google Sheet. However, now I am yearning to create a login form that verifies the stored data and redirects the user to a different pa ...

Using mySQLi to store query results in an array and display them in separate DIV containers

I am looking to efficiently query the content of multiple IDs (from 1 to 6) from a mySQL database using mySQLi. Once I retrieve the content, I want to display it in separate DIVs. Currently, I am using the following code which works perfectly: <?php $c ...

What is the best way to repair a table header?

How do I make the table header fixed so only the table body scrolls? * { padding: 0px; margin: 0px; } body { padding: 0px; margin: 0px; } .responsive { max-width: 100%; height: auto; } /* Other CSS code here */ /* Include necessary exter ...

Mixing percentage width with a fixed minimum width in CSS results in divs failing to align in a single line

Having an issue with the responsiveness of a website layout that includes three columns (let's say 'A', 'B', and 'C') each 96% high, along with a footer. Columns A and C have a width of 35%, while column B is set to be 30 ...

Parent menu fails to trigger the opening of child menu upon clicking

I'm struggling to modify a Wordpress theme to enable the child menus to expand when clicking on the parent menus. Is there a way to edit this code to make that functionality work? // Implement expandable menus var expand_link = $('<a class="m ...

Is there a way to position the search bar on a new line within the navigation bar when the screen size is at its maximum width for mobile

I have a search bar on my navigation bar, but I am looking to move it to the next line within a maximum width if the screen display is extra small (xs) or for mobile devices. Below is the code snippet: <nav class="navbar navbar-expand-md fixed-top ...

Different sources for multiple iframes

Greetings everyone, I am facing an issue with multiple iframes on my page, each with a different src attribute. Despite specifying unique sources for each iframe, upon loading the page, they all seem to be loaded with the same src. <html><body&g ...

JavaScript: A guide on sending an uploaded email to a web service in byte array format

Scenario: My website is built using EXTJS6. I have a web service that requires the uploaded email to be sent in byte array format. Inquiry: What is the process for converting a .msg file to a byte array using JS (or EXTJS)? Can we treat it as a simple bin ...

Learn how to incorporate a vertical divider pipe into your website using Bootstrap

Hello, I'm having trouble adding a separator between nav-links that actually works. I tried adding the following code snippet: nav-link:after { content:"|"; } But unfortunately, it's either not working at all or appearing on the left side of th ...

Is there a solution to fix the issue with IE causing hover effects not to

I'm currently in the process of designing a website, and I have implemented some image hover effects that reveal elements within the image when you hover over it. These effects are functioning correctly on Chrome, Safari, and Firefox; however, they ar ...