The height of my row decreases when I implement the z-index for a hover effect

Hey there! I'm currently working on creating a hover effect for my cards using Bootstrap and z-index. However, I've run into an issue where the z-index works fine when I hover over the cards, but the row loses its height. I tried adding a height to the row, which fixed the issue, but then it lost its responsiveness. This created a problem when viewing the cards on different resolutions where there was excessive space. I really need the hover effect to be responsive across different resolutions and I want to maintain the position: absolute; property to ensure the z-index only raises the cards and not push them. Thank you so much for taking the time to read this, and I'm hopeful that you can provide some guidance.

Here is an example of my current setup

I attempted to add a height to the row, but it negatively impacted the responsiveness of the layout.

.row{
  height:300px;
}

.row {
  width: 100%;
}

.card {
  transition: 1s;
}

.card:hover {
  position: absolute !important;
  top: 0px;
  width: 130%;
  z-index: 1;
  transition(all .2s ease-out);
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d3b1bcbca7a0a7a1b2a393e6fde3fde2">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="57353838232423253627176279677966">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>

<div>
  <div class="row bg-danger">
    <div class="mt-2 col-lg-4 col-md-6 col-12">
      <div class="card m-3" style="width: 18rem; height:20rem;">
        <div class="card-body">
          <h1 class="card-text">card 1</h1>
        </div>
      </div>
    </div>
  </div>
  <div class="row bg-warning">
    <div class="mt-2 col-lg-4 col-md-6 col-12">
      <div class="card m-3  " style="width: 18rem; height:20rem;">
        <div class="card-body">
          <h1 class="card-text">Card 2</h1>
        </div>
      </div>
    </div>
  </div>

Answer №1

It seems like you are looking to elevate your card slightly when it is being hovered over. To achieve this effect, simply modify the card's styles on hover as shown below:

.card:hover{
    transform: translateY(-10px);
    width: 130%;
    z-index: 1;
    transition: all 0.2s ease-out;
 }

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

React Redux failing to correctly map the action to props

I have a function called updateChapter that is responsible for updating the database. I have included this function in my component named EditChapter. However, when I checked the props of the component, the updateChapter action was missing. In another com ...

Clickability of links on an element is lost when it is positioned behind another element that is fixed

I can't seem to figure out why the green menu is hidden behind the white header, making its links unclickable. It's necessary for the layout of the page, but it's causing this issue. The white header has a position: fixed; attribute. The gr ...

Ways to connect to a minimized hidden tabindex component using the hashtag symbol

I have created a glossary with terms in columns and hidden texts using plain css/html. Each entry is structured like this: A term followed by a hidden explanation, revealed on focus without the use of Java or JS. Instead of using :hover, I utilize :focus ...

Tips on eliminating certain text from a hyperlink

I need assistance with removing the text  Title from my link while preserving the image. <tr id="group0"> <td colspan="100" nowrap="" class="ms-gb"> <a href="javascript:" onclick="javascript:ExpCollGroup('28-1_', ...

Oops! We encountered an issue where too many hooks were rendered compared to the

Hey everyone, I'm facing an issue when trying to connect 2 queries in my code. function MyApp(){ let companyId = fetchCompany(window.location.pathname); if(companyId !== undefined){ console.log(companyId); } let employees = fetchEmployees ...

I'm looking to showcase the list in a navigation bar by clicking on the hamburger menu. I want to include the 'home' and 'about' text specifically

Having trouble implementing the hamburger menu functionality in my HTML/CSS project. When clicked on a shrunken screen, I want the 'Home' and 'About' text in the nav to appear stacked on top of each other. JS is causing me some difficul ...

The error message "TypeError: Router.use() expects a middleware function, but received a [type of function]" is a common occurrence in FeathersJS

Struggling to bind a method to my /userAuthenticationInfo route, I've made several adjustments in my code based on other posts related to this issue but still unable to make it work. I am using feathersJS's express implementation, and even with e ...

What are some alternative methods for storing temporary data in MERN applications?

Currently working on creating a multi-step form that includes basic information fields and the ability for users to upload images. I am considering how to temporarily store the data before pushing it to the database once the user completes all steps and s ...

Once I published my website on Github pages, I encountered a critical issue with the URL that I'm struggling to resolve

UPDATE NOTICE!! I meticulously followed the guidelines to deploy my ReactJS page on Github. I referred to resources from https://facebook.github.io/create-react-app/docs/deployment and Despite multiple attempts, the error message I encountered during th ...

Clicking to Load Images - Angular

Implementing a feature to load sets of images on button click instead of loading all at once. Although lazy load plugins are available, I decided to experiment with this approach. Here's the logic: Start with a data array called 'Images' co ...

Unable to adjust the text color to white

As someone who is new to Typescript, I'm facing a challenge in changing the text color to white and struggling to find a solution. I'm hoping that someone can guide me in the right direction as I've tried multiple approaches without success ...

I require assistance in displaying a dynamic, multi-level nested object in HTML using AngularJS

I have a complex dynamic object and I need to extract all keys in a nested ul li format using AngularJS. The object looks like this: [{"key":"campaign_1","values":[{"key":"Furniture","values":[{"key":"Gene Hale","values":[{}],"rowLevel":2},{"key":"Ruben A ...

The functionality of the "mui-one-time-password-input" is not compatible when used in conjunction with the "formik" library

I'm currently working on a Next.js project, and I need to integrate the mui-one-time-password-input library for OTP input. Additionally, I am using the formik library for form validation. However, I encountered an issue when attempting to set the val ...

Issue with Bootstrap v3.3.7 panel not collapsing as expected following height adjustment

Utilizing bootstrap 3.3.7 panels, I encountered an issue when trying to slide up the panel using the icon. The panel would not hide properly once the panel height was set, resulting in only the panel content body sliding up. Here is an example: $(&apo ...

"Divs are now linked and drag as one cohesive unit instead of

As I was experimenting with making images draggable and resizable, I encountered a small issue. When I attempted to drag two or more images, they would merge into one large draggable object instead of remaining separate. My goal was to make each image drag ...

The drop-down links vanish into the depths of the webpage's body

Can someone assist with my drop-down menu issue for the link "services"? The link disappears behind the page content when I try to modify it. Any help would be appreciated, thank you! This is the CSS: .bodycontent { margin: 0 25% 0 25%; ...

Error: Please provide a JWT for authentication in Express.js - JsonWebTokenError

Description: I am in the process of developing a web application that utilizes Express.js for the backend and React for the frontend. My main focus is on implementing user authentication through the use of JSON Web Tokens (JWT). However, I have hit a roadb ...

I'm looking to switch out the `~` to turn it into a URL for the backend, seeing as `<img alt="" src="~/media/Banner/plane.JPG">` is returning a 404 error

1. Received an HTTP Request and JSON response from the backend localhost:3000 (entered value using wysiwyg) { "Description": "&lt;img alt=&quot;&quot; src=&quot;~/media/Banner/plane.JPG&quot; /&gt;1 test berita&lt ...

Analyzing the HTTP status codes of various websites

This particular element is designed to fetch and display the HTTP status code for various websites using data from a file called data.json. Currently, all sites are shown as "Live" even though the second site does not exist and should ideally display statu ...

NextJS-created calendar does not begin on the correct day

I'm facing an issue with my calendar code where it starts rendering on a Wednesday instead of a Monday. I want to adjust the layout so that it always begins on a Monday by adding some empty boxes at the start of the calendar. Essentially, I need to s ...