R
R
Roma Zvarich2019-05-12 15:28:54
css
Roma Zvarich, 2019-05-12 15:28:54

How to organize (z-index) so that (:hover) works?

Hello.
Please help me understand how to solve the problem with z-index.
Each card has a background that is slightly offset.
Implemented it via ::after .
But when this pseudo-element is set to "z-index: -1", this background is hidden not only behind the background of the card, but also behind the background of the parent card container.
I tried to set "z-index: -2" for the parent container too.
But then ":hover" stops working for cards.
What am I doing wrong and how to solve it?
Thanks
Code with transparent background of parent container: https://codepen.io/hisbvdis/pen/oRLMWg
Code with white background of parent container:https://codepen.io/hisbvdis/pen/MdeBmq
5cd8114322bb9995433091.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
display: block, 2019-05-12
@hisbvdis

.cards-container{
    position: relative;
    z-index: 0;
}

V
Viktor Taran, 2017-04-27
@webinar

And why are you adding it after cnc?
I wrote here, https://klondike-studio.ru/standarts/standartnyy-h...
do not forget that it is not always necessary to deliver, sometimes you need to remove it, for example, if it is a picture.
It is described in more detail here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question