D
D
Dan20132020-05-08 16:35:54
css
Dan2013, 2020-05-08 16:35:54

hover problem?

I have a problem, I have a picture on hover, it should become transparent and text appears on it. But when I hover the mouse over the text, the hover attribute leaves the picture.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
D
drawnofmymind, 2020-05-08
@drawnofmymind

oh , I would like to see the code (
well, in general, the text through translateX / Y ()

A
Alexander Sharomet, 2020-05-08
@sharomet

<div>
картинка
текст
</div>
div:hover {
ваш код
}

F
FinGanapre, 2020-05-08
@FinGanapre

Wrap the image and text in a div. On hover on this div, change the styles of the picture and text.
For example, this way
To display text, you can make another substrate and apply a background to it. There are many options here.
In your implementation, the hover works because you track it from the picture. As soon as the text covers the image, the hover event leaves it.

F
Froggyweb, 2020-05-08
@Froggyweb

Hover should not be put on the picture, but on the wrapper

V
VVS10, 2020-05-08
@VVS10

top: 50%;
left: 50%
transform: translate(-50%, -50%);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question