I am trying to align around 5 html components in one single line using bootstrap.
But could not and looks ugly like this, breaking to second line instead of being in one line.
HTML
<div class="form-group">
<p class="col-md-2 badge col-md-offset-1">Column 1</p>
<p class="col-md-1 badge">Column 2</p>
<p class="col-md-1 badge">Column 3</p>
<p class="col-md-2 badge">Column 4</p>
<p class="col-md-2 badge">Column 5</p>
</div>
<div class="form-group" ng-repeat="data in allData">
<label class="control-label col-md-3">{{data.label}}</label>
<div class="input-group col-md-4">
<input id="reportTypeId" type="text" class="form-control" ng-model="data.reportTypeId" style="display: none">
<datepicker date-format="yyyy-MM-dd">
<input id="startDate" type="text" class="form-control" ng-model="data.startDate">
</datepicker>
<p class="input-group-addon glyphicon glyphicon-calendar"></p>
<datepicker date-format="yyyy-MM-dd">
<input id="endDate" type="text" class="form-control" ng-model="data.endDate">
</datepicker>
<p class="input-group-addon glyphicon glyphicon-calendar"></p>
<select class="form-control" ng-model="data.countryId" required="required">
<option value="">Please select</option>
<option ng-repeat="country in countrys" value="{{country.countryId}}">{{country.countryLabel}}</option>
</select>
<select class="form-control" ng-model="data.cityCode" required="required">
<option value="">Please select</option>
<option ng-repeat="city in cities" value="{{city.code}}">{{city.desc}}</option>
</select>
</div>
</div>
Updated:-
JSFiddle : http://jsfiddle.net/jjayaraman/5dbkf1xw/
Hope this is what you are looking for. Took me awhile to figure it out, but I believe it's because you are wanting to hide that first text box, but you were specifying a col-md-1, which made the spacing look out of whack. Remove the col-md-1 and I think it's what you're looking for.
I also added some rows, and the container to get some better spacing.
Note: I was toying with the background-color properties to SEE where stuff was on the page.
<div class="container">
<div class="row">
<div class="form-group">
<div class="col-md-2 badge col-md-offset-1">Column 1</div>
<div class="col-md-2 badge">Column 2</div>
<div class="col-md-2 badge">Column 3</div>
<div class="col-md-2 badge">Column 4</div>
<div class="col-md-2 badge">Column 5</div>
</div>
</div>
<div class="row">
<div class="col-md-1" style="background-color: yellow;">
<input id="reportTypeId" type="text" class="form-control" style="display: none">
</div>
<div class="col-md-2" style="background-color: red;">
<label class="control-label">Label</label>
</div>
<div class="col-md-2 input-group" style="background-color: green; padding-left: 5px; padding-right: 5px; float: left;">
<input id="startDate" type="text" class="form-control" ng-model="data.startDate">
<p class="input-group-addon glyphicon glyphicon-calendar"></p>
</div>
<div class="col-md-2 input-group" style="background-color: blue; padding-left: 5px; padding-right: 5px; float: left;">
<input id="endDate" type="text" class="form-control" ng-model="data.endDate">
<p class="input-group-addon glyphicon glyphicon-calendar"></p>
</div>
<div class="col-md-2">
<select class="form-control" ng-model="data.countryId" required="required">
<option value="">Please select</option>
<option ng-repeat="country in countrys" value="{{country.countryId}}">{{country.countryLabel}}</option>
</select>
</div>
<div class="col-md-2">
<select class="form-control" ng-model="data.cityCode" required="required">
<option value="">Please select</option>
<option ng-repeat="city in cities" value="{{city.code}}">{{city.desc}}</option>
</select>
</div>
</div>
</div>
http://jsfiddle.net/0yd6c7yt/
Related
I'm having issues with my last row not showing at all when I compile the program. I tried many things but there seems to be an issue with the Select element because what ever I try to add after the first Select row doesn't show up.
What am I missing?
Here is my code:
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="~/css/OpenStore.css" asp-append-version="true" />
</head>
<p align="center" style="color:red">
Open Store
</p>
<div class="OpenStore">
<form class="form-horizontal" asp-action="SearchStore" asp-controller="Home" method="get" enctype = "multipart/form-data">
<div class="row">
<div class="form-group form-group-sm col-sm-6 col-md-13">
<div class="row col-md-13">
<label class="col-form-label col-md-6">Store # :</label>
<div class="col-sm-3">
<input class="form-control form-control-sm" asp-for="StoreId" value="" style="width:100px;" />
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group form-group-sm col-sm-6 col-md-13">
<div class="row">
<label class="col-form-label col-md-6">Store Name :</label>
<div class="col-sm-3">
<input class="form-control form-control-sm" asp-for="StoreDescription" value="" style="width:350px;" />
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group form-group-sm col-sm-6 col-md-13">
<div class="row">
<label class="col-form-label col-md-6">Language :</label>
<div class="col-sm-3">
<select list="Languages" asp-for="LanguageId" class="form-control form-control-sm" id="Language" style="width:100px"/>
<datalist id="Languages">
<option data-value="English">English</option>
<option data-value="Fr">French</option>
</datalist>
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group form-group-sm col-sm-6 col-md-13">
<div class="row">
<label class="col-form-label col-md-6">Group :</label>
<div class="col-sm-3">
<select list="Groups" asp-for="StoreTypeId" class="form-control form-control-sm" id="Group" style="width:100px"/>
<datalist id="Groups">
<option data-value="2">>Laura</option>
<option data-value="3">Melanie Lyne</option>
</datalist>
</div>
</div>
</div>
</div>
</form>
</div>
</html>
Here is what it looks like in chrome:
html render
The second <select> is not shown, because the closing </select> tag is missing. <select> tags are used with <option> tags inside them.
<select asp-for="LanguageId" class="form-control form-control-sm" id="Language"
style="width:100px">
<option data-value="English">English</option>
<option data-value="French">French</option>
</select>
The list attribute is not valid for select. If you want to use a datalist you should switch to <input> tags.
Please use the <select></select> instead of <select/>
<select list="Groups" asp-for="StoreTypeId" class="form-control form-control-sm" id="Group" style="width:100px"></select>
<form class="form-horizontal" asp-action="SearchStore" asp-controller="Home" method="get" enctype="multipart/form-data">
<div class="row">
<div class="form-group form-group-sm col-sm-6 col-md-13">
<div class="row col-md-13">
<label class="col-form-label col-md-6">Store # :</label>
<div class="col-sm-3">
<input class="form-control form-control-sm" asp-for="StoreId" value="" style="width:100px;" />
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group form-group-sm col-sm-6 col-md-13">
<div class="row">
<label class="col-form-label col-md-6">Store Name :</label>
<div class="col-sm-3">
<input class="form-control form-control-sm" asp-for="StoreDescription" value="" style="width:350px;" />
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group form-group-sm col-sm-6 col-md-13">
<div class="row">
<label class="col-form-label col-md-6">Language :</label>
<div class="col-sm-3">
<select list="Languages" asp-for="LanguageId" class="form-control form-control-sm" id="Language" style="width:100px"></select>
<datalist id="Languages">
<option data-value="English">English</option>
<option data-value="Fr">French</option>
</datalist>
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group form-group-sm col-sm-6 col-md-13">
<div class="row">
<label class="col-form-label col-md-6">Group :</label>
<div class="col-sm-3">
<select list="Groups" asp-for="StoreTypeId" class="form-control form-control-sm" id="Group" style="width:100px"></select>
<datalist id="Groups">
<option data-value="2">>Laura</option>
<option data-value="3">Melanie Lyne</option>
</datalist>
</div>
</div>
</div>
</div>
</form>
I have a select dropdown box in html which is like below:
<div class="form-group col-md-6">
<label for="party_starter">Party Start Time</label>
<select id="party_starter" name="party_start_time" class="party_time" required="">
<option value="">Party Start Time</option>
<option value="Morning">Morning</option>
<option value="Highty">High Tea</option>
<option value="Dinner">Dinner</option>
</select>
</div>
below is complete code:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<div style="margin-top: 10%;"></div>
<div style="background-color: white;">
<div class="container">
<div style="background-color: #f5f5f5; border-radius: 10px;" class="table-responsive">
<table class="table ">
<tbody>
<tr>
<!--<th width="10%">Image</th>-->
<th width="20%">Name</th>
<th width="10%">Quantity</th>
<th width="10%">Price</th>
<th width="15%">Total</th>
<!--<th width="15%">Action</th>-->
</tr>
<tr>
<td>
<a target="_blank" href="http://btp.vasugroup.in/event-details/CAKES/5" style="color:red;"></a>
</td>
<td class="tdcls">
<input type="hidden" class="cart_qty24" name="cart_qty" value="1"> 1 </td>
<td><i class="fa fa-inr"> </i></td>
<td><i class="fa fa-inr"> 0</i></td>
</tr>
<tr>
<td colspan="3" align="right">Total</td>
<td><i class="fa fa-inr"> 0</i></td>
</tr>
</tbody>
</table>
</div>
<div style="margin-top: 1%;" class="row">
<div class="col-md-6">
<div style="background-color: #f5f5f5; border-radius: 10px;" class="col-md-12 border-1px">
<div class="billing-details">
<h3 class="mb-30">Customer Details</h3>
<div class="row">
<div class="form-group col-md-6">
<label for="checkuot-form-fname2">Phone No.</label>
<input id="checkuot-form-fname2" type="text" name="mobile_number" maxlength="10" class="form-control check-fill" max-length="10" value="" placeholder="Phone Number" required="">
</div>
<div class="form-group col-md-6">
<label for="checkuot-form-fname">Full Name</label>
<input id="checkuot-form-fname" name="customer_name" type="text" class="form-control check-fill" required="" placeholder="Full Name">
</div>
<div class="form-group col-md-6">
<label for="checkuot-form-lname">Email</label>
<input id="checkuot-form-lname" type="email" name="customer_email" required="" class="form-control check-fill" placeholder="Email">
</div>
<div class="form-group col-md-6">
<label>Address</label>
<textarea class="form-control check-fill" required="" name="customer_address" placeholder="Add Your Complete Address" rows="3"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div style="background-color: #f5f5f5; border-radius: 10px;" class="col-md-12 border-1px">
<div class="billing-details">
<h3 class="mb-30">Event Details</h3>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="checkuot-form-fname">Event Title </label>
<input id="checkuot-form-fname" type="text" name="product_info" value="Birthday," class="form-control" readonly="">
</div>
<div class="form-group col-md-8">
<label for="checkuot-form-city">Event Location</label>
<input id="checkuot-form-city" type="text" required="" name="texLocation" class="form-control" placeholder="Event Location">
</div>
<div class="form-group col-md-4">
<label for="party_date">Party Date</label>
<input class="form-control party_date check-fill hasDatepicker" id="party_date" value="" type="date" required="" name="datPartyDate" placeholder="Party Date" autocomplete="off" aria-required="true" data-booked-dates="[""]">
</div>
<div class="form-group col-md-6">
<label for="party_starter">Party Start Time</label>
<select id="party_starter" name="party_start_time" class="party_time" required="">
<option value="">Party Start Time</option>
<option value="Morning">Morning</option>
<option value="Highty">High Tea</option>
<option value="Dinner">Dinner</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
</div>
<div class="col-md-6">
</div>
</div>
</div>
</div>
the dropdown is working fine when its taken separate, but not with my complete code
the label and the select dropdown is not coming in the same line even after giving the for an attribute in a label. can anyone please tell me what is wrong in my code
The problem is with the class assigned to the div of Party Start Time. i.e col-md-6 which is of small width size to fit in both label and select in one line.
To fix it, use the below code:
<div class="form-group col-md-8">
<label for="party_starter">Party Start Time</label>
<select id="party_starter" name="party_start_time" class="party_time" required="">
<option value="">Party Start Time</option>
<option value="Morning">Morning</option>
<option value="Highty">High Tea</option>
<option value="Dinner">Dinner</option>
</select>
</div>
It is not coming in the same line because of the class You are using for the that contain both label and dropdown, so You can remove the class "col-md-6", and you can add style "width:auto" OR "display:inline-block"
<div class="form-group " style="display:inline-block">
.......
</div>
<div class="form-group " style="width:auto">
I'm having some trouble with a Twitter Bootstrap form alignment. I have a checkbox that causes the below div's to incorrectly line up with the grid because it's height is only 70px tall when the div next to it is 74px. I could add the CSS to force it to the pixel height needed (see id "test") but I don't want this stay a fixed height when content responds for smaller screens. What would be the best way to fix this?
<div class="container-fluid appointment">
<div class="container">
<div class="row">
<h2 class="text-center">Appointment Request</h2>
<form>
<div class="col-sm-4">
<div class="form-group">
<label for="">Phone Number:</label>
<input type="tel" class="form-control" id="phone">
</div>
</div>
<div class="col-sm-8">
<div class="form-group">
<label for="email">Email Address:</label>
<input type="email" class="form-control" id="email">
</div>
</div>
<div class="col-sm-7">
<div class="form-group">
<label for="petname">Pet's Name:</label>
<input type="text" class="form-control" id="petname">
</div>
</div>
<div class="col-sm-5" id="test">
<div class="form-group">
<label>Is your pet neutered or spayed?</label>
<div class="checkbox">
<label for="neutered"><input type="checkbox" id="neutspay">Neutered/Spayed</label>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label for="pettype">Pet Type:</label>
<select class="form-control" id="pettype">
<option>Select Pet Type...</option>
</select>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label for="breed">Breed Type:</label>
<select class="form-control" id="breed">
<option>Select Breed...</option>
</select>
</div>
</div>
<div class="col-sm-2">
<div class="form-group">
<label for="age">Pet Age:</label>
<select class="form-control" id="age">
<option>Select Pet Age...</option>
<option value="less than 1">Less than 1 year</option>
<option value="1">1 Year</option>
</select>
</div>
</div>
<div class="col-sm-12 text-center">
<div class="form-group">
<button type="submit" class="btn btn-lg">Send Appointment</button>
</div>
</div>
</form>
</div>
</div>
</div>
just add a class "clearfix" for the div containing the checkbox as
<div class="col-sm-5" id="test">
<div class="form-group clearfix">
<label>Is your pet neutered or spayed?</label>
<div class="checkbox">
<label for="neutered"><input type="checkbox" id="neutspay">Neutered/Spayed</label>
</div>
</div>
</div>
Based on my code, is there any way to make the dropdown list align with the other input fields?
I need to add an icon right next to the dropdown list. However, class="form-control" should be 100% width by default but it doesn't after I added the icon.
<form asp-action="Apply" asp-controller="Jobs">
<div class="form-horizontal">
<div class="form-group">
<label asp-for="Name" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Name" class="form-control" />
</div>
</div>
<div class="form-group">
<label asp-for="YearsAttended" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="YearsAttended" class="form-control" min="0" value="0"/>
</div>
</div>
<div class="form-group">
<label asp-for="HighestQualification" class="col-md-2 control-label"></label>
<div class="col-md-10 form-inline">
<select asp-for="HighestQualification" asp-items="Html.GetEnumSelectList<QualificationLevel>()" class="form-control">
<option value="">Choose one...</option>
</select>
help</i>
</div>
</div>
</div>
</form>
You're probably best making use of Input Groups provided by bootstrap.
HTML
<div class="form-group">
<label asp-for="HighestQualification" class="col-md-2 control-label"></label>
<div class="col-md-10">
<div class="form-inline input-group">
<select asp-for="HighestQualification" asp-items="Html.GetEnumSelectList<QualificationLevel>()" class="form-control">
<option value="">Choose one...</option>
</select>
<span class="input-group-addon">
<a href='#' >
<i class="material-icons" style="vertical-align: middle;">help</i>
</a>
</span>
</div>
</div>
</div>
Then adjust the input-group-addon styling to remove the "grey" that comes default
CSS
.input-group-addon {
padding: 0 6px;
color: inherit;
background-color: transparent;
border: none;
}
JSFIDDLE
He's all aligned, but the label is getting 'stuck' on page side.
I tried using 'margin-left' but then he distorted everything else.
I want the result to be like this:
Below is my code:
http://jsfiddle.net/vzm7et7z/1/
HTML:
<div class="container">
<div class="row">
<div class="col-md-8">
<form id="form-sms" class="form-horizontal" method="post" action="salva.php">
<fieldset>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="operadora">OPERADORA</label>
<div class="col-md-8">
<select id="operadora" name="operadora" class="form-control">
<option value="">Selecione uma operadora</option>
<option value="CLARO">Claro</option>
<option value="CTBC">CTBC</option>
<option value="OI">Oi</option>
<option value="NEXTEL">Nextel</option>
<option value="TIM">TIM</option>
<option value="VIVO">Vivo</option>
</select>
</div>
</div>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="ddd_destinatario">DESTINATÁRIO</label>
<div class="col-md-4">
<select id="ddd_destinatario" name="campoDDD_d" class="form-control">
<option value="">DDD</option>
<option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option><option value="32">32</option><option value="33">33</option><option value="34">34</option><option value="35">35</option><option value="36">36</option><option value="37">37</option><option value="38">38</option><option value="39">39</option><option value="40">40</option><option value="41">41</option><option value="42">42</option><option value="43">43</option><option value="44">44</option><option value="45">45</option><option value="46">46</option><option value="47">47</option><option value="48">48</option><option value="49">49</option><option value="50">50</option><option value="51">51</option><option value="52">52</option><option value="53">53</option><option value="54">54</option><option value="55">55</option><option value="56">56</option><option value="57">57</option><option value="58">58</option><option value="59">59</option><option value="60">60</option><option value="61">61</option><option value="62">62</option><option value="63">63</option><option value="64">64</option><option value="65">65</option><option value="66">66</option><option value="67">67</option><option value="68">68</option><option value="69">69</option><option value="70">70</option><option value="71">71</option><option value="72">72</option><option value="73">73</option><option value="74">74</option><option value="75">75</option><option value="76">76</option><option value="77">77</option><option value="78">78</option><option value="79">79</option><option value="80">80</option><option value="81">81</option><option value="82">82</option><option value="83">83</option><option value="84">84</option><option value="85">85</option><option value="86">86</option><option value="87">87</option><option value="88">88</option><option value="89">89</option><option value="90">90</option><option value="91">91</option><option value="92">92</option><option value="93">93</option><option value="94">94</option><option value="95">95</option><option value="96">96</option><option value="97">97</option><option value="98">98</option><option value="99">99</option>
</select>
</div>
<div class="col-md-4">
<input id="telefone_destinatario" name="campoCEL_d" type="text" placeholder="" maxlength="9" class="form-control input-md numerico" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="nome">SEU NOME</label>
<div class="col-md-8">
<input id="nome" name="nome" type="text" placeholder="" class="form-control input-md" required="">
</div>
</div>
<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="ddd_remetente">SEU NÚMERO</label>
<div class="col-md-4">
<select id="ddd_remetente" name="campoDDD_r" class="form-control">
<option value="">DDD</option>
<option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option><option value="32">32</option><option value="33">33</option><option value="34">34</option><option value="35">35</option><option value="36">36</option><option value="37">37</option><option value="38">38</option><option value="39">39</option><option value="40">40</option><option value="41">41</option><option value="42">42</option><option value="43">43</option><option value="44">44</option><option value="45">45</option><option value="46">46</option><option value="47">47</option><option value="48">48</option><option value="49">49</option><option value="50">50</option><option value="51">51</option><option value="52">52</option><option value="53">53</option><option value="54">54</option><option value="55">55</option><option value="56">56</option><option value="57">57</option><option value="58">58</option><option value="59">59</option><option value="60">60</option><option value="61">61</option><option value="62">62</option><option value="63">63</option><option value="64">64</option><option value="65">65</option><option value="66">66</option><option value="67">67</option><option value="68">68</option><option value="69">69</option><option value="70">70</option><option value="71">71</option><option value="72">72</option><option value="73">73</option><option value="74">74</option><option value="75">75</option><option value="76">76</option><option value="77">77</option><option value="78">78</option><option value="79">79</option><option value="80">80</option><option value="81">81</option><option value="82">82</option><option value="83">83</option><option value="84">84</option><option value="85">85</option><option value="86">86</option><option value="87">87</option><option value="88">88</option><option value="89">89</option><option value="90">90</option><option value="91">91</option><option value="92">92</option><option value="93">93</option><option value="94">94</option><option value="95">95</option><option value="96">96</option><option value="97">97</option><option value="98">98</option><option value="99">99</option>
</select>
</div>
<div class="col-md-4">
<input id="telefone_remetente" name="campoCEL_r" type="text" placeholder="" maxlength="9" class="form-control input-md numerico" required="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="campoSMS">MENSAGEM</label>
<div class="col-md-8 control-zero">
<textarea name="campoSMS" id="campoSMS" class="form-control textarea-sms" maxlength="100"></textarea>
<p class="help-block textarea-contagem"></p>
</div>
</div>
<div class="form-group">
<div class="col-md-4 control-zero">
<button id="enviar" name="enviar" class="btn btn-enviar">ENVIAR!</button>
</div>
</div>
</fieldset>
</form>
</div>
CSS:
.form-horizontal .control-label{
/* text-align:right; */
height: 34px;
text-align:left;
background: #A0D468;
font-size: 16px;
}
.btn-form {
padding: 0;
}
.btn-enviar {
background: #8e44ad;
color: #ffffff;
font-size: 16px;
font-weight: bold;
}
.btn-enviar:hover {
background: #BE90D4;
color: #ffffff;
}
The issue is the column structure of Bootstrap CSS. Right now, you have:
<label class="col-md-4 control-label"></label>
<div class="col-md-8"></div>
Which makes the perfect col-md-12 for fullsize view. When you shrink this, it doesn't know how to handle the overflow, which is why the first col-md-4 appears in the wrong spot above the input. You're gonna want to look into visibile-sm, visible-xs, hidden-md etc classes of Bootstrap and design a separate layout for smaller devices. For example:
<div class="hidden-md hidden-lg">
<div class="row">
<div class="col-sm-12 col-xs-12">
<label>Example:</label>
</div>
<div class="col-sm-12 col-xs-12">
<input type="text" name="example" class="form-control" value=""/>
</div>
</div>
</div>
<div class="hidden-sm hidden-xs">
<div class="row">
<div class="col-md-4 col-lg-4">
<label>Example:</label>
</div>
<div class="col=md-8 col-lg-8">
<input type="text" name="example" class="form-control" value=""/>
</div>
</div>
</div>
Will render different designs for the same element depending on the size of the browser. Hopefully that can give you some insight, but it's up to you to figure out how you want your website/application laid out.
Change your <label class="col-md-4 control-label"></label> to
<div class="col-md-4">
<label class="control-label"></label>
</div>
use style="margin-left:15px;" with labels, its working fine, i have tested