Created
January 9, 2025 21:28
-
-
Save benpearson/1e09a84aed06c0a79105f6df309a7685 to your computer and use it in GitHub Desktop.
Embed core block: Styles
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
/* ------------------------------------------------------------ *\ | |
Core block: Embed | |
Editor styles only | |
\* ------------------------------------------------------------ */ | |
.wp-block-embed { | |
@include wp-block-embed; | |
} |
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
/* ------------------------------------------------------------ *\ | |
Mixins: Embed (video) core block | |
Included in frontend and admin styles. | |
\* ------------------------------------------------------------ */ | |
@mixin wp-block-embed { | |
@include blocks-core__margin-vertical__large; | |
figcaption { | |
@include figcaption; | |
} | |
} | |
/** | |
* Frontend styles. | |
* | |
* Don't edit here, edit mixins used instead as they are used in the editor too. | |
*/ | |
@mixin wp-block-embed__frontend { | |
& > .wp-block-embed { | |
@include wp-block-embed; | |
overflow-wrap: break-word; | |
// These styles are copied from core admin styles and are needed for embed to look OK on the frontend | |
&.wp-has-aspect-ratio { | |
.wp-block-embed__wrapper:before { | |
content: ""; | |
display: block; | |
padding-top: 50%; | |
} | |
iframe { | |
position: absolute; | |
top: 0; | |
right: 0; | |
bottom: 0; | |
left: 0; | |
height: 100%; | |
width: 100%; | |
} | |
} | |
&.wp-embed-aspect-21-9 .wp-block-embed__wrapper:before { | |
padding-top: 42.85%; | |
} | |
&.wp-embed-aspect-18-9 .wp-block-embed__wrapper:before { | |
padding-top: 50%; | |
} | |
&.wp-embed-aspect-16-9 .wp-block-embed__wrapper:before { | |
padding-top: 56.25%; | |
} | |
&.wp-embed-aspect-4-3 .wp-block-embed__wrapper:before { | |
padding-top: 75%; | |
} | |
&.wp-embed-aspect-1-1 .wp-block-embed__wrapper:before { | |
padding-top: 100%; | |
} | |
&.wp-embed-aspect-9-16 .wp-block-embed__wrapper:before { | |
padding-top: 177.77%; | |
} | |
&.wp-embed-aspect-1-2 .wp-block-embed__wrapper:before { | |
padding-top: 200%; | |
} | |
.wp-block-embed__wrapper { | |
position: relative; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment