Html-Code example:
<div class="row">
<div class="col-md-12 col-sm-6" id="div1"></div>
<div class="col-md-12 col-sm-6" id="div2"></div>
<div class="col-md-12" id="div3"></div>
</div>
After spending quite a lot of time I discovered that if you don't specify all rules on specific @media size, bootstrap behaves on a strange way.
In this example on small devices "div3
" becomes a container of div1
, div2
and all the content (ex: buttons
) isn't more accessible.
Shouldn't be defined a default rule? like col-sm-12
, or is right this way?
It has been very tricky to find out.
EDIT
Bootstrap doc says:
Grid classes apply to devices with screen widths greater than or equal to the breakpoint sizes, and override grid classes targeted at smaller devices. Therefore, e.g. applying any .col-md-* class to an element will not only affect its styling on medium devices but also on large devices if a .col-lg-* class is not present.
In this case col-md-12
apply on small devices in a strange way.