Question

Am looking to make this a pure responsive css grid for 11 html divs.

enter image description here

<div class="dashboard page-container">w100%, h100%
    <div class="box1">w20%, h25%</div>
    <div class="box2">w20%, h25%</div>
    <div class="box3">w20%, h25%</div>
    <div class="box4">w20%, h25%</div>
    <div class="box5">w35%, h30%</div>
    <div class="box6">w30%, h65%</div>
    <div class="box7">w15%, h90%</div>
    <div class="box8">w35%, h35%</div>
    <div class="box9">w65%, h15%</div>
    <div class="box10">w65%, h20%</div>
    <div class="box11">w15%, h10%</div>
</div><!--/dashboard-->

Responsive in the sense of the container being width:100% and height 100%,

..with each box a percent of the page-container.

Have been working at it, but have yet to get the floats working correctly.. Grateful for any assistance with this

Was it helpful?

Solution

This solution uses floats.

FIDDLE

I had to swap the order of the boxes and add 2 containers to your original HTML markup.

HTML :

<div class="dashboard page-container">
    <div class="col1">
        <div class="box1">w20%, h25%</div>
        <div class="box2">w20%, h25%</div>
        <div class="box3">w20%, h25%</div>
        <div class="box4">w20%, h25%</div>
    </div>
    <div class="col2">
        <div class="box6">w30%, h65%</div>
        <div class="box5">w35%, h30%</div>
        <div class="box8">w35%, h35%</div>
        <div class="box9">w65%, h15%</div>
        <div class="box10">w65%, h20%</div>
    </div>
    <div class="box7">w15%, h90%</div>
    <div class="box11">w15%, h10%</div>
</div><!--/dashboard-->

CSS :

html, body, .dashboard {
    width:100%;
    height:100%;
    margin:0;
}
.col1, .col2, .box7, .box11 {
    float:left;
}
.col1 {
    width:20%;
    height:100%;
}
.col1 > div {
    width:100%;
    height:25%;
}
.col2 {
    width: 65%;
    height:100%;
}
.box6 {
    float:right;
    width: 47.5%;
    height:65%;
}
.box5, .box8 {
    width:52.5%;
}
.box5 {
    height:30%;
}
.box8 {
    height:35%;
}
.box9 {
    height:15%;
}
.box10 {
    height:20%;
}
.box7, .box11 {
    width:15%;
}
.box7 {
    height:90%;
}
.box11 {
    height:10%;
}
/* following just to see what we are doing :) */
 div {
    border:2px solid red;
    box-sizing:border-box;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top