how can I do so that a "hover" in css does not alter the position of the other "divs"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how can I do so that a "hover" in css does not alter the position of the other "divs"?

I want to make that when you hover the mouse the image gets bigger, but when using "hover" the other div elements also move, as could you do so that they do not move? I mean, hold your position.

24th Jul 2020, 11:44 PM
Sam Vásquez
Sam Vásquez - avatar
4 Answers
+ 4
Sam Vásquez , What property do you use in your img:hover{ } to make the image bigger? If you use transform:scale(1.5) for exemple, it won't move other images.
25th Jul 2020, 12:21 AM
EmmanueLZ.
EmmanueLZ. - avatar
+ 4
use position:absolute for them ,as far as I know they shudn't move then
25th Jul 2020, 12:03 AM
Abhay
Abhay - avatar
0
Well i think you should use the transform property thats much better
2nd Oct 2021, 3:43 PM
Travon
Travon - avatar
0
If applied on links within nav section, position: absolute upon :hover MOVES the 'active' one to almost the center of the header - just so you know. --- transition: scale(1.2) works best (at least in my project) but still moves the other links a bit --> BUT this might be down to my other settings i.e. display: flex & justify-content: space-evenly.
3rd May 2023, 10:40 AM
Monika