A
A
Alexey Laud2017-08-31 17:11:58
JavaScript
Alexey Laud, 2017-08-31 17:11:58

How to set the background size in CSS to cover + a few percent?

There is a block with background-color, when you hover over any part of the block, you need to zoom in on the image.
Due to the fact that the image format can be different, sometimes the image leaves blank fields.
So far the only option has been to use 100% 100% unhovered and 115% 115% hovered, but that distorts the images.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dollar, 2019-05-11
@LenovoId

https://ru.wikipedia.org/wiki/Percentage

x = x * 0.9 //оставить 90%, то есть по сути отнять 10%
x = x - 0.1 * x //от х отнять 10%

In any way possible. The main thing is to understand what interest is in fact.

C
Conan the Barbarian, 2017-08-31
@JaredWinter

Try it with transform: scale(); play around

O
one_day, 2017-08-31
@one_day

:hover {
transform: scale(1.15, 1.15);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question