I
I
Ivan Tabakerka2020-01-24 19:45:03
Sass
Ivan Tabakerka, 2020-01-24 19:45:03

Why is the hover effect not responding when hovering over the parent element?

<div class="srv_elem">
        <div class="srv_bg"></div>
        <div class="srv_info"></div>
</div>

.srv_elem
    width: 260px
    height: 420px
.srv_bg
    width: 260px
    height: 400px
.srv_info
    width: 260px
    height: 400px
    margin: -400px 0 0 0
.srv_elem .srv_info:hover
    margin: -400px 0 0 260px

When hovering over the srv_elem block, the srv_info block does not respond.
Am I screwed up with the sass syntax? Tell me how it's right.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2020-01-24
@IvanTabakerka

.srv_elem:hover .srv_info
it's better like this

.srv_elem
    width: 260px
    height: 420px
        &:hover
             .srv_info
                 margin: -400px 0 0 260px
.srv_bg
    width: 260px
    height: 400px
.srv_info
    width: 260px
    height: 400px
    margin: -400px 0 0 0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question