Last active
July 29, 2016 01:09
-
-
Save nuflowx/398415e1058ba8706a2ae48b777f8aac to your computer and use it in GitHub Desktop.
Get rid of the black bars of embeded youtube or similar video with CSS media queries
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
If you don't want the black bars on a video in your site these might do the trick for you: | |
``` | |
@media all and (min-aspect-ratio: 16/9) { | |
.video { | |
width: 100vw; | |
height: calc(100vw * (9/16)); | |
} | |
} | |
@media all and (max-aspect-ratio: 16/9) { | |
.video { | |
height: 100vh; | |
width: calc(100vh * (16/9)); | |
} | |
} | |
``` | |
Code by [Liam Martens](https://github.com/LiamMartens), just saving it here for reference |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐫