Update CSS to preserve video aspect ratio

This commit is contained in:
Felix Albrigtsen 2022-08-08 16:36:58 +02:00
parent 1cde0a2a93
commit fc6d5d5f8e
1 changed files with 4 additions and 9 deletions

View File

@ -45,12 +45,12 @@ $doorTime = date("H:i", $doorEntry->time);
.iframe-container {
position: relative;
overflow: hidden;
width: 100%;
padding-top: 30%;
max-width: 100%;
max-height: 100%;
aspect-ratio: 16/9;
margin: 0 auto;
}
/* Then style the iframe to fit in the container div with full height and width */
.responsive-iframe {
position: absolute;
top: 0;
@ -58,13 +58,8 @@ $doorTime = date("H:i", $doorEntry->time);
bottom: 0;
right: 0;
width: 100%;
height: 100%;
aspect-ratio: 16/9;
}
@media (max-width: 768px) {
.iframe-container {
padding-top: 0;
}
}
</style>
<div class="iframe-container" style="max-width: 100em;">
<iframe class="responsive-iframe" src="https://www.youtube.com/embed/Uy6HAvMdeuA" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen ></iframe>