Last active
March 1, 2023 13:14
-
-
Save LeoSeyers/d5838dd13d9fba4791fe2b38037d1e33 to your computer and use it in GitHub Desktop.
Vimeo Full Screen Video Background
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.c-cover { | |
--height: 100dvh; | |
--safe-height: var(--height, var(--vh)); | |
--container-width: 100vw; | |
--container-height: var(--safe-height); | |
position: relative; | |
height: var(--container-height); | |
overflow: hidden; | |
width: var(--container-width); | |
iframe { | |
/* [1] video width and height variables are inherited from inline styles */ | |
--height-width-ratio: (var(--video-height) / var(--video-width)); // [1] | |
--width-height-ratio: (var(--video-width) / var(--video-height)); // [1] | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
width: var(--container-width); | |
height: calc(var(--container-width) * var(--height-width-ratio)); | |
min-height: var(--container-height); | |
min-width: calc(var(--container-height) * var(--width-height-ratio)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To do : custom lite-vimeo