Skip to content

Instantly share code, notes, and snippets.

@sergiu-radu
Created January 14, 2021 20:36
Show Gist options
  • Save sergiu-radu/dbe2c5ec30d38436c6027ead2d171d2b to your computer and use it in GitHub Desktop.
Save sergiu-radu/dbe2c5ec30d38436c6027ead2d171d2b to your computer and use it in GitHub Desktop.
Embedded videos ratio
.wp-block-embed__wrapper:before {
content: '';
display: block;
padding-top: var(--aspect-ratio, 50%);
}
.wp-block-embed__wrapper iframe,
.wp-block-embed__wrapper .container-lazyload,
.wp-block-embed__wrapper > .jetpack-video-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
// 1:1
.wp-embed-aspect-1-1 {
--aspect-ratio: 100%;
}
// 1:2
.wp-embed-aspect-1-2 {
--aspect-ratio: 200%;
}
// 21:9
.wp-embed-aspect-21-9 {
--aspect-ratio: 42.85%;
}
// 4:3
.wp-embed-aspect-4-3 {
--aspect-ratio: 75%;
}
// 16:9
.wp-embed-aspect-16-9 {
--aspect-ratio: 56.25%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment