html - Flipping rows to columns in Bootstrap grid responsively -


given following grid layout of buttons:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">    <form class="form" role="form">    <div class="form-group">      <div class="col-sm-6">        <button type="button" class="btn btn-block btn-default">button a1</button>      </div>      <div class="col-sm-6">        <button type="button" class="btn btn-block btn-default">button a2</button>      </div>    </div>    <div class="form-group">      <div class="col-sm-6">        <button type="button" class="btn btn-block btn-default">button b1</button>      </div>      <div class="col-sm-6">        <button type="button" class="btn btn-block btn-default">button b2</button>      </div>    </div>    <div class="form-group">      <div class="col-sm-6">        <button type="button" class="btn btn-block btn-default">button c1</button>      </div>      <div class="col-sm-6">        <button type="button" class="btn btn-block btn-default">button c2</button>      </div>    </div>  </form>

if run in narrow viewport each letter pair of buttons visibly grouped/touching. if run in wide viewport (click "full page" button) numbered triplets touching letter pairs separated column gap.

i want lettered buttons visibly regardless of viewport size. tried flipping layout:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">    <form class="form" role="form">    <div class="form-group">      <div class="col-sm-4">        <button type="button" class="btn btn-block btn-default">button a1</button>      </div>      <div class="col-sm-4">        <button type="button" class="btn btn-block btn-default">button b1</button>      </div>      <div class="col-sm-4">        <button type="button" class="btn btn-block btn-default">button c1</button>      </div>    </div>    <div class="form-group">      <div class="col-sm-4">        <button type="button" class="btn btn-block btn-default">button a2</button>      </div>      <div class="col-sm-4">        <button type="button" class="btn btn-block btn-default">button b2</button>      </div>      <div class="col-sm-4">        <button type="button" class="btn btn-block btn-default">button c2</button>      </div>    </div>  </form>

and, unsurprisingly, things reversed: numbers grouped in small viewport , letters grouped in large viewport.

is there simple way make letters appear grouped regardless? still want have grid layout in larger viewport sizes though, , don't want have define custom rules/classes case.

edit: try make clearer, trying achieve is:

  • in narrow viewports, appear first snippet in narrow viewport: full-width buttons arranged in 3 groups of 2 same-letter buttons, vertical separation between each group of two.

  • in wide viewports, appear second snippet in wide viewport: 3 columns, each containing 2 same-letter buttons no vertical separation, horizontal separation between columns.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">    <div class="container">    <form class="form" role="form">      <div class="form-group">        <div class="col-sm-16">          <button type="button" class="btn btn-block btn-default">button a1</button>        </div>        <div class="col-sm-16">          <button type="button" class="btn btn-block btn-default">button a2</button>        </div>      </div>      <div class="form-group">        <div class="col-sm-16">          <button type="button" class="btn btn-block btn-default">button b1</button>        </div>        <div class="col-sm-16">          <button type="button" class="btn btn-block btn-default">button b2</button>        </div>      </div>      <div class="form-group">        <div class="col-sm-16">          <button type="button" class="btn btn-block btn-default">button c1</button>        </div>        <div class="col-sm-16">          <button type="button" class="btn btn-block btn-default">button c2</button>        </div>      </div>    </form>  </div>


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -