css - Bootstrap Layout Confusion -


i know bootstrap design mobile first. wonder if possible layout possible bootstrap's css classes?

layout

figure on size col-md or larger

and when screen col-sm or col-xs, go b or c. (2 different solutions).

i'm looking correct div layouts a->b , a->c.

the heights each section random because content generated in them dynamic. added heights in divs filler, dynamic , can't set.

the following not work...

fiddle ... https://jsfiddle.net/s4jj30wf/

<div class="row">     <div style="background:blue" class="col-xs-12 col-md-4">         <div style="height:100px"></div>     </div>     <div style="background:yellow" class="col-md-8 col-xs-12">         <div class="row">             <div style="background:green" class="col-md-12 col-xs-12">                 <div style="height:20px"></div>             </div>             <div style="background:pink" class="col-md-12 col-xs-12">                 <div style="height:100px"></div>             </div>             <div style="background:red" class="col-md-12 col-xs-12">                 <div style="height:100px"></div>             </div>         </div>     </div>     <div style="background:orange" class="col-md-4 col-md-pull-4 col-xs-12">         <div style="height:50px"></div>     </div> </div> 

solution: there 2 ways based on if columns have static height or dynamic height. if have static height have pure css solution using float , clear property margin-top property achieve this.

sample pure css fixed height of columns:

http://codepen.io/nasir_t/pen/zbogoe

if height not fixed , dynamic need use of jquery adjust margin-top property in order dynamically kill gap between mis-aligned 2 elements based on a->b , a->c scenario. using default jquery , modernizr js simple solution.

sample jquery & css solution dynamic column height:

http://codepen.io/nasir_t/pen/vmjopd

hope helps.


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -