twitter bootstrap - Inline forms >> Horizontal forms for mobile resolutions -
i'd have 2 form elements inline desktop resolutions, on phone resolutions, screws look. there easy way take below code , break out of inline stack them if phone resolution detected?
<form class="form-inline"> <div class="form-group"> <label class="sr-only" for="exampleinputamount">amount (in dollars)</label> <div class="input-group"> <div class="input-group-addon">$</div> <input type="text" class="form-control" id="exampleinputamount" placeholder="amount"> <div class="input-group-addon">.00</div> </div> </div> <button type="submit" class="btn btn-primary">transfer cash</button> </form>
we can using 2 columns on small devices.
i wrapped form inside container
div.
i added single row 2 columns of size 6 small devices.
and added custom class btn-sm-block
button in order make full width on small devices.
@media , (max-width:768px) { .btn-sm-block { width: 100%; display:block; } }
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="container"> <form class="form-inline"> <div class="row"> <div class="form-group col-xs-6"> <label class="sr-only" for="exampleinputamount">amount (in dollars)</label> <div class="input-group"> <div class="input-group-addon">$</div> <input type="text" class="form-control" id="exampleinputamount" placeholder="amount"> <div class="input-group-addon">.00</div> </div> </div> <div class="form-group col-xs-6"> <button type="submit" class="btn btn-primary btn-sm-block">transfer cash</button> </div> </div> </form> </div>
Comments
Post a Comment