Skip to content

Instantly share code, notes, and snippets.

@cassilup
Created June 27, 2018 10:14
Show Gist options
  • Save cassilup/104cc2844875db1da05a4887b0562714 to your computer and use it in GitHub Desktop.
Save cassilup/104cc2844875db1da05a4887b0562714 to your computer and use it in GitHub Desktop.
16:9 POC
<div class="wrapper">
<div class="top-content" >
top
</div>
<div class="left-content">
left
</div>
<div class="video">
<div class="video-content" id="video_content">
</div>
</div>
<div class="right-content">
right
</div>
<div class="bottom-content" >
bottom
</div>
</div>
document.addEventListener("DOMContentLoaded", function(event) {
console.log(document.getElementById("video_content").getBoundingClientRect());
});
body {
margin: 0;
}
.wrapper {
color: white;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr;
align-items: center;
justify-content: center;
height: 100vh;
background: transparent;
}
.video {
width: 60vw;
position: relative;
}
.video:before {
content: "";
position: absolute;
border: 2px solid green;
left: 0;
right: 0;
top: 0;
z-index: -1;
bottom: 0;
}
.video-content {
background: transparent;
border: 2px solid black;
border-radius: 5px;
box-sizing: border-box;
padding-bottom: 56.25%;
width: 100%;
}
.top-content, .bottom-content, .video {
grid-column: 2;
}
.left-content {
grid-column: 1;
}
.right-content {
grid-column: 3;
}
.left-content, .right-content {
grid-row: 1/4;
height: 100%;
}
.left-content, .right-content, .top-content, .bottom-content {
height: 100%;
background: green;
display: flex;
align-items: center;
justify-content: center;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment