javascript - How to set fixed auto width in tab-content bootstrap? -
i have search box forms using bootstrap css included several columns based on category selection. first add columns in same line , set auto width them accordingly
.col-lg-12 { width: 100%; } .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { float: left; } .col-md-6 { width: 50%; } .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { float: left; } .form-group { margin-bottom: 15px; } .tab-content { position: relative; }
<div class="tab-content"> <form style="margin-top:-20px" method="get" action=""> <div class="col-xs-12 col-md-12 col-lg-12 col-sm-12 go-right"> <div class="form-group"> <img src="http://elizavetababanova.com/wp-content/uploads/2015/06/blue-number-1-md.png" style="width:30px"> </div> </div> <div class="col-xs-12 col-md-12 col-lg-12 col-sm-12"> <div class="form-group"> <img src="http://www.orangecoastcollege.edu/student_services/counseling/siteassets/pages/degreeworks-plan---priority-registration/number-2-orange-md.png" style="width:30px"> </div> </div> <div class="col-md-6 col-sm-6 col-xs-6 go-right"> <div class="form-group"> <img src="http://www.clipartbest.com/cliparts/9cz/e6x/9cze6xlri.png" style="width:30px"> </div> </div> <div class="clearfix"></div> </form> </div>
this short example code, there many columns in search box, how set css columns in same line , auto width
i want show columns in same line , automatically adjust sizes based on width, if have more columns adjusted auto width. auto set width each columns , columns. images in below
for example if have 6 sections auto re-size , set width 100%
and if 3 sections, set width 100%
well, think there misunderstanding around bootstrap css here.
if want use bootstrap, don't have override rules, specially do.
the "col" 's classes in bootstrap used define how element displayed on page whatever device.
here's little explanation class suffixes :
- the "lg" stand "large" (large screen, desktops)
- the "md" stand "medium" (medium devices, can desktops too)
- the "sm" stand "small" (tablets)
- the "xs" stand "extra small" (phones)
- the number stand space take on screen (12 maximum)
so don't have override rules, use them correctly. example, i've made jsfiddle, can find somthing similar looking : https://jsfiddle.net/valentinho14/etdsruy4/
and practices, please follow common ways write rules(it's order phones desktop) :
<div class="col-xs-x col-sm-x col-md-x col-lg-x"></div>
if don't need of them, or want set same size whatever device, use smaller rules :
<div class="col-xs-6"></div> <!-- take 50% of screen on phones, tablets , desktop
to have more informations this, please check official bootstrap doc, explain details of grid system : http://getbootstrap.com/css/#grid
update
here solution when have 7 columns. actually, bootstrap not provide native way handle kind of situation(5 columns, 7 columns) : https://jsfiddle.net/valentinho14/hgxtt2bn/
this inspired answer : https://stackoverflow.com/a/21955398/4673732
Comments
Post a Comment