Skip to content

Instantly share code, notes, and snippets.

@nuflowx
Last active July 29, 2016 01:09
Show Gist options
  • Save nuflowx/398415e1058ba8706a2ae48b777f8aac to your computer and use it in GitHub Desktop.
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
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
@benja
Copy link

benja commented Jul 29, 2016

🐫

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment