My current challenge involves adding a hover color to a specific div, but I'm facing obstacles due to the gradient background that was implemented to achieve border-radius functionality.
This task is being carried out within a React Component using css-modules.
I am not a CSS expert and would appreciate insight into the root cause of the issue and possible solutions.
.card{
width: 40%;
height: 150px;
border: 2px solid transparent;
background:
linear-gradient(#fff,#fff) padding-box,
linear-gradient(125deg, #42E4A3, #A383E8) border-box;
border-radius:8px;
display:inline-block;
}
.card:hover{
background-color: rgba(0,0,0,0.04);
}
<div class="card">
No Hover color red <br/>
I am doing this in React a small gist of the problem
</div>
Update
Upon implementing the specified styles, I encountered an unexpected outcome where the border gradient color shows up on hover. Adding certain changes results in the appearance of the color, but causes the border color to disappear.
The gradient seems to have restrictions when it comes to accepting low-opacity rgba values. I'm curious to understand why.
.card:hover{
background:
linear-gradient(rgba(0,0,0,0.04),rgba(0,0,0,0.04)) padding-box;
} // no border color , when i change the color to rgba opacity it dosent work
rgba(0,0,0,0.1) works but why not rgba(0,0,0,0.04)