The way I wrote this code is different in that the cover/jacket image isn’t responsive, only the video itself.
Did I set this up right?
And Is there anything that can be improved?
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
body {
background: #000000;
}
.outer {
display: table;
height: 100%;
margin: 0 auto;
width: 100%;
}
.tcell {
display: table-cell;
vertical-align: middle;
padding: 8px 8px;
}
.video-wrapper {
min-width: 40%;
max-width: 640px;
margin: auto;
}
.ratio-keeper {
position: relative;
padding-top: 56.25%;
}
.video-frame {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.jacket {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
width: 200px;
height: 200px;
cursor: pointer;
background: url("https://via.placeholder.com/200x200") no-repeat 0 0;
background-size: cover;
border-radius: 25px;
border: 3px solid #0059dd;
box-sizing: border-box;
}
.play {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
width: 64px;
height: 64px;
fill: red;
filter: drop-shadow(3px 3px 3px rgba(0, 0, 0, 0.7));
}
.wrap iframe {
position: absolute;
top: -3px;
left: -3px;
width: calc(100% + 6px);
height: calc(100% + 6px);
}
.wrap {
position: absolute;
top: -3px;
left: -3px;
width: calc(100% + 6px);
height: calc(100% + 6px);
overflow: hidden;
border-radius: 25px;
border: 3px solid red;
box-sizing: border-box;
}
.hide {
display: none;
}
<div class="outer">
<div class="tcell">
<div class="video-wrapper">
<div class="ratio-keeper">
<div class="jacket" title="Play">
<svg class="play" viewBox="0 0 64 64">
<path d="M25.6,46.4L44.8,32L25.6,17.6V46.4z M32,0C14.3,0,0,14.3,0,32s14.3,32,32,32s32-14.3,32-32S49.7,0,32,0z
M32,57.6C17.9,57.6,6.4,46.1,6.4,32S17.9,6.4,32,6.4S57.6,17.9,57.6,32S46.1,57.6,32,57.6z" />
</svg>
</div>
<div class="wrap hide">
<div class="video video-frame" data-id="M7lc1UVf-VE"></div>
</div>
</div>
</div>
</div>
</div>