REORDER BOOTSTRAP COLS IN XS

created: 11.12.2018 13:22

edited: never

back

html

html
<!DOCTYPE html>
<html>
  <head>
    <script src="//code.jquery.com/jquery.min.js"></script>
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    <meta charset="utf-8">
    <title>JS Bin</title>
  </head>
  <body>

    <div class="row reorder-xs">
      <div class="col-xs-12 col-sm-6">
        <p>test1</p>
      </div>

      <div class="col-xs-12 col-sm-6">
        <p>test2</p>
      </div>
    </div>

  </body>
</html>

css

css
[class*="col-"] {
  background-color: gold;
}

@media (max-width: 767px) {

  .row.reorder-xs {
    -webkit-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    -ms-transform: rotate(180deg);
    -o-transform: rotate(180deg);
    transform: rotate(180deg);

    direction: rtl;
  }

  .row.reorder-xs > [class*="col-"] {
    -webkit-transform: rotate(-180deg);
    -moz-transform: rotate(-180deg);
    -ms-transform: rotate(-180deg);
    -o-transform: rotate(-180deg);
    transform: rotate(-180deg);

    direction: ltr;
  }

}