I'm writing a template for a project and i'm stuck with a problem.
I want to get a template like this:
Each rectangle should be 16/9. There is a main rectangle in the upper left and the other smaller around. All must be responsive and possibly I would not use any framework (Also I would like to be compatible with IE9+). That is what I managed to do so far (there is a link to Codepen):
*,
*:before,
*:after {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
}
/* Grid */
.grid {
display: block;
background: black;
}
/* Clearfix */
.grid:before,
.grid:after {
content: "";
display: table;
line-height: 0;
}
.grid:after {
clear: both;
}
/* Unit */
.unit {
width: 100%;
float: left;
}
/* Dimensions */
.whole {
width: 100%;
}
.half {
width: 50%;
}
.two-thirds {
width: 66.6665%;
}
.one-third {
width: 33.3332%;
}
.one-quarter {
width: 25%;
}
.three-quarters {
width: 75%;
}
/* Gutters */
.unit {
padding: 2.5px;
}
.no-gutters {
padding: 0;
}
.no-left-gutters {
padding-left: 0;
}
.no-right-gutters {
padding-right: 0;
}
/* Content */
.content {
position: relative;
background-color: gray;
width: 100%;
height: 0;
padding-bottom: 56.25%;
/* 16:9 */
}
.content div {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
/* Responsive Stuff */
@media screen and (max-width: 500px) {
.unit {
width: auto;
float: none;
}
}
/* Specific CSS */
.container {
position: relative;
}
.containers > div {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.player {
background-color: red;
}
<div class="grid container">
<div class="unit three-quarters no-right-gutters">
<div class="unit whole">
<div class="content player">
<div>Player</div>
</div>
</div>
<div class="grid">
<div class="unit one-third">
<div class="content">
<div>Thumb</div>
</div>
</div>
<div class="unit one-third">
<div class="content">
<div>Thumb</div>
</div>
</div>
<div class="unit one-third">
<div class="content">
<div>Thumb</div>
</div>
</div>
</div>
</div>
<div class="unit one-quarter no-left-gutters">
<div class="unit whole">
<div class="content">
<div>Thumb</div>
</div>
</div>
<div class="unit whole">
<div class="content">
<div>Thumb</div>
</div>
</div>
<div class="unit whole">
<div class="content">
<div>Thumb</div>
</div>
</div>
<div class="unit whole">
<div class="content">
<div>Thumb</div>
</div>
</div>
</div>
</div>
What am I doing wrong? Is my approach wrong?
EDIT: Solved http://codepen.io/Mulder90/pen/KVKMKO :)