html - Center input field in bootstrap -


this code show input left of div

<div class="col-sm-8 col-md-7" style="min-width: 270px;"> <input type="text" name="address" class="form-control" value="<?php echo$data["address"]; ?>"> </div> 

i intent center , align div , show same. sorry english. much. regards

if understand correctly want, following should center input field:

<div class="col-sm-8 col-md-7" style="min-width: 270px;"> <input type="text" name="address" class="form-control" value="<?php echo$data["address"]; ?>" style="margin: auto;"> </div> 

by default though, bootstrap's .form-control fields set 100% width won't notice difference. add width: 50% example , see appear in center.

updated answer:

it looks need center container div rather input field. can use col-md-offset-* that:

<div class="col-sm-8 col-md-7 col-md-offset-2" style="min-width: 270px;"> <input type="text" name="address" class="form-control" value="<?php echo$data["address"]; ?>"> </div> 

as bootstrap's grid consists of 12 columns, won't center while using col-md-7. need use col-md-8 , col-md-offset-2 make center.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -