Switching bootstrap columns to mobile view
Consider the following:
<div class="row"> <div id="side_panel" class="col-md-3 cold-xs-12"> Side panel </div> <div id="mainContentRight" class="col-md-9 cold-xs-12 "> Main content area </div> </div> Is there a way to switch the order of these columns for mobile viewing so that the main content appears in front of the sidebar?
+4
2 answers
Unfortunately, you cannot change the order of using push and pull for 12 column classes, i.e. col-xs-12 . Either change the layout to be able to include a 12-column grid or use a simple solution using flexbox below:
@media (max-width: 768px) { .reorder { display: flex; flex-direction: column; } #side_panel { order: 2; } } <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" /> <div class="row reorder"> <div id="side_panel" class="col-md-3 cold-xs-12"> Side panel </div> <div id="mainContentRight" class="col-md-9 cold-xs-12"> Main content area </div> </div> 0