html - New to Boostrap; how can I clean this code up + achieve the desired affect? -
edit: see updated js fiddle link @ bottom of question; achieved desired affect still feel though code can "cleaner"!
i've been experimenting html/css while i'm building first layout using twitter-bootstrap. first question i've had ask, appreciate input.
i feel section of code i'm sharing can "cleaned up." i've got looking mostly want can't think there's easier way achieve want.
see js fiddle.
what i'm trying this: on md+ size screens have 2 rows of diamonds, 4 on first row , 3 on second. when user on small or x-small screen, diamonds shift 3 rows, 3 on first row, 2 on second, , 3 on third. want them spaced apart. seeing js fiddle, i've got looking how want on md+ screens, problem can't seem row 1 , 3 on small , x-small screens align second row.
what best way this? way seems messy. i'd use html/css in case has js disabled. thank you. :)
<section class="container-fluid diamonds"> <div class="row"> <div class="col-md-10 col-md-offset-1"> <div class="xsrow1"> <div class="col-md-3 col-xs-6 xsright no-padding"><img src="http://i57.tinypic.com/o5565j.png"></div> <div class="col-md-3 col-xs-6 no-padding"><img src="http://i57.tinypic.com/o5565j.png"></div> </div> <div class="xsrow2"> <div class="col-md-3 col-xs-4 no-padding"><img src="http://i57.tinypic.com/o5565j.png"></div> <div class="col-md-3 col-xs-4 no-padding"><img src="http://i57.tinypic.com/o5565j.png"></div> </div> </div> <div class="col-md-8 col-md-offset-2 mdrow2"> <div class="xsrow2"> <div class="col-md-4 col-xs-4 no-padding"><img src="http://i57.tinypic.com/o5565j.png"></div> </div> <div class="xsrow3"> <div class="col-md-4 col-xs-6 xsright no-padding"><img src="http://i57.tinypic.com/o5565j.png"></div> <div class="col-md-4 col-xs-6 no-padding"><img src="http://i57.tinypic.com/o5565j.png"></div> </div> </div> </div> </section> .no-padding { padding: 0!important; padding-right: 3px!important; padding-left: 3px!important; margin: 0!important; } .diamonds { position: relative; } .diamonds img { width: 100%; height: auto; } @media (max-width: 991px) { .xsrow1 img, .xsrow3 img { width: 66.66667%!important; height: auto; } .xsright { text-align: right; } } @media (min-width: 992px) { .mdrow2 { position: absolute; top: 51%; left:0%; padding-left: 3%; padding-right: 3%; } } edit: well, figured out method works me, although still feel messy. updated js fiddle here. if has easier method please feel free share. :)
you use preprocessor, add more semantic classes markup , remove layout classes (col etc), mixin styles want classes.
Comments
Post a Comment