html - How do I line up input fields with bootstrap? -
i don't think quite understand how bootstrap works grid. want name , actual field match unless screen size xs every field own row. each row, want text boxes aligned.
here's i've tried.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <div class="container" style="width:80vw"> <form role="form"> <div class="row top-buffer"> <div class="col-sm-4 "> <div class="form-group"> <label for="inputlabel3" class="col-sm-3 control-label">date:</label> <div class="col-sm-8"> <input type="date" class="form-control" id="inputlabel3" placeholder="date"> </div> </div> </div> <div class="col-sm-4 "> <div class="form-group"> <label for="inputname" class="col-sm-4 control-label">name:</label> <div class="col-sm-8 "> <input type="text" class="form-control" id="name" placeholder="name"> </div> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label for="inputpassword" class="col-sm-3 control-label">initials:</label> <div class="col-sm-8"> <input type="text" class="form-control" id="inputinitials" placeholder="initials"> </div> </div> </div> </div> <div class="row top-buffer"> <div class="col-sm-12"> <div class="form-group"> <label for="inputlabel3" class="col-sm-1 control-label">title:</label> <div class="col-sm-10 "> <input type="text" class="form-control" id="inputlabel3" placeholder="title"> </div> </div> </div> </div> <div class="row top-buffer"> <div class="col-sm-5"> <div class="form-group"> <label for="inputlabel3" class="col-sm-2 control-label">expected:</label> <div class="col-sm-10 "> <input type="number" class="form-control" id="inputlabel3" placeholder="title"> </div> </div> </div> <div class="col-sm-5"> <div class="form-group"> <label for="actual" class="col-sm-2 control-label">actual:</label> <div class="col-sm-10 "> <input type="number" class="form-control" id="inputlabel3" placeholder="title"> </div> </div> </div> </div> </div> <div class="row top-buffer"> <div class="col-sm-12"> <div class="form-group"> <label for="inputlabel3" class="col-sm-1 control-label">description:</label> <div class="col-sm-10 "> <textarea id="descript" class="col-sm-10 "></textarea> </div> </div> </div> </div> </div> <!-- end container --> </div
bonus points can me make description field larger - enough height @ least 20 new lines.
this includes 20 spaces in despcription add .css
.col-sm-4 { display: inline-block; vertical-align: middle; float: none; }
<div class="container" style="width:80vw"> <form role="form"> <div class="row top-buffer"> <div class="col-sm-4 "> <div class="form-group"> <label for="inputlabel3" class="col-sm-3 control-label">date:</label> <div class="col-sm-8"> <input type="date" class="form-control" id="inputlabel3" placeholder="date"> </div> </div> </div> <div class="col-sm-4 "> <div class="form-group"> <label for="inputname" class="col-sm-4 control-label">name:</label> <div class="col-sm-8 "> <input type="text" class="form-control" id="name" placeholder="name"> </div> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label for="inputpassword" class="col-sm-3 control-label">initials:</label> <div class="col-sm-8"> <input type="text" class="form-control" id="inputinitials" placeholder="initials"> </div> </div> </div> </div> <div class = "row top-buffer"> <div class="col-sm-12"> <div class="form-group"> <label for="inputlabel3" class="col-sm-1 control-label">title:</label> <div class="col-sm-10 "> <input type="text" class="form-control" id="inputlabel3" placeholder="title"> </div> </div> </div> </div> <div class = "row top-buffer"> <div class="col-sm-5"> <div class="form-group"> <label for="inputlabel3" class="col-sm-2 control-label">expected:</label> <div class="col-sm-10 "> <input type="number" class="form-control" id="inputlabel3" placeholder="title"> </div> </div> </div> <div class="col-sm-5"> <div class="form-group"> <label for="actual" class="col-sm-2 control-label">actual:</label> <div class="col-sm-10 "> <input type="number" class="form-control" id="inputlabel3" placeholder="title"> </div> </div> </div> </div> </div> <div class = "row top-buffer"> <div class="col-sm-12"> <div class="form-group"> <label for="inputlabel3" class="col-sm-1 control-label">description:</label> <div class="col-sm-10 "> <textarea id="descript" class="col-sm-10" rows="20"></textarea> </div> </div> </div> </div> </div> <!-- end container --> </div
Comments
Post a Comment