css - Hover not removing styling on mouseoff -
i have video moves on hover:
.video:hover { z-index: 5; transform: translate(1vw, -1vh); }
the video shifts when hover on it, , shifts when mouse off it. however, if mouse off left, video not shift back. how can fix this? thanks!
note: happens if mouse off (and left, of course).
it's not working because moving element that's triggering move. need wrap .video
in 1 more div (called .video-wrapper
).
then can use .video-wrapper:hover .video
move inner element.
also, didn't work before because forgot comma between x, y values.
.cell { height: 20vw; border: 0.5vh solid #5776b9; width: 35vw; } .fit { height: inherit; width: inherit; } .video-wrapper{ display:inline-block; margin:2vw; } .video-wrapper:hover .video { transform: translate(1vw, -1vh); }
<div class="video-wrapper"> <div class="video cell"> <video class="fit" controls> <source src="http://clips.vorwaerts-gmbh.de/vfe_html5.mp4" type="video/mp4"> </video> </div> </div>
Comments
Post a Comment