html - Three columns div layout design with adjustable -


i want know how to design 3 column div layout adjustable in deference sizes showing in image.

enter image description here

  • when desktop size (770px) first column have 2 div , others have 1 divs.

  • when tablet size (600px) first column have 3 divs , other have 1 div. has 2 columns.

  • when mobile size (less 600px) divs have 1 columns.

please find order colors in image. sample code without proper styles.

html:

<div class="body">   <div class="c1">blue</div>   <div class="c2">pink</div>   <div class="c3">green</div>   <div class="c4">yellow</div> </div> 

css:

@media screen , (min-width: 0px) {   .c1 { width:100%; }   .c2 { width:100%; }   .c3 { width:100%; }   .c4 { width:100%; } } @media screen , (min-width: 600px) {   .c1 { width:25%; }   .c2 { width:25%; }   .c3 { width:75%; }   .c4 { width:25%; } } @media screen , (min-width: 768px) {   .c1 { width:25%; }   .c2 { width:25%; }   .c3 { width:50%; }   .c4 { width:25%; } } 

i tried order property in css, not working properly.

you missing styles make layout work. i'm assuming had trouble making middle diagram fit other 2 because of source order , change in layout. here's css picked media queries:

@media screen , (min-width: 0px) { .c1{ width:100%; min-height:5vh; } .c2{ width:100%; min-height:5vh; } .c3{ width:100%; min-height:80vh;} .c4{ width:100%; min-height:10vh;} } @media screen , (min-width: 600px) { .c1{ width:50%; min-height:10vh; float:left; } .c2{ width:50%; min-height:10vh; float:left; clear:left;} .c3{ width:50%; min-height:80vh; position:absolute;right:0;} .c4{ width:50%; min-height:10vh; float:left; clear:left;} } @media screen , (min-width: 768px) { .c1{ width:25%;} .c2{ width:25%; float:right;clear:right;} .c3{ width:50%; left:25%;} .c4{ width:25%;} } 

demo codepen:
http://codepen.io/anon/pen/krqxlq


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -