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">
Related
I am working on a HTML file where there is a row class(id="new-row") and inside the row there is a column (id="BillSum"). Now there are contents in the row/ specifically in the column of the row. I want to decrease the height of the row/the column inside the row but the CSS properties I specified isn't working. Can someone please tell where is the problem and what is the solution? I am pasting the code.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="row" id="new-row">
<div class="col-lg-7"></div>
<div class="col-lg-5" id="BillSum">
<div id="bs" class="flex bg-gray-200">
<label>Bill Summary</label>
</div>
<div class="row" id="st-id">
<label>Sub total</label>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">$</span>
<input type="text" id="st" name="Sub total" class="form-control Subtotal" placeholder="0.00" aria-label="Username" aria-describedby="basic-addon1"></td>
</div>
<!-- <input type="text" id="st" name="Sub total" class="form-control Subtotal" value="0"> -->
</div>
<div class="row" id="tax-id">
<label>Tax</label>
<div class="col=lg-6">
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">%</span>
<input type="text" id="tax1" name="tax1" class="form-control tax1" placeholder="Enter Tax %" aria-label="Username" aria-describedby="basic-addon1" onkeyup="calculate(this.value);"></td>
<input type="text" id="tax2" name="tax2" class="form-control tax2" placeholder="" aria-label="Username" aria-describedby="basic-addon1">
</div>
<!-- <input type="text" id="tax1" name="tax1" class="form-control tax1" placeholder="Enter Tax %" onkeyup="calculate(this.value);"> -->
<!-- </div>
<div class="col=lg-6">
<input type="text" id="tax2" name="tax2" class="form-control tax2">
</div> -->
</div>
</div>
<div class="row" id="dis-id">
<label>Discount(-)</label><br>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">$</span>
<input type="text" id="discBill" name="Discount_Bill" class="form-control disc1st" aria-label="Username" aria-describedby="basic-addon1" onkeyup="calculate(this.value);"></td>
</div>
<!-- <input type="text" id="discBill" name="Discount_Bill" class="form-control disc1st" onkeyup="calculate(this.value);"> -->
</div>
<div class="row" id="np-id">
<label>Net payable</label><br>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">$</span>
<input type="text" id="net_payable" name="Net_Payable" class="form-control disc2st" aria-label="Username" aria-describedby="basic-addon1"></td>
</div>
<!-- <input type="text" id="net_payable" name="Net_Payable" class="form-control disc2st"> -->
</div>
<div class="row" id="ra-id">
<label>Received amount</label><br>
<input type="text" id="received_amount" name="Received_amount" class="form-control ra" placeholder="Enter payment amount">
</div>
<div class="row" id="pv-id">
<label>Payvia</label><br>
<select class="form-control">
<option>Select</option>
<option>A</option>
<option>B</option>
<option>C</option>
<option>D</option>
</select>
</div>
<div class="row" id="remarks">
<label>Remarks</label><br>
<input type="text" name="Sub total" class="form-control" placeholder="Write your remarks">
</div>
</div>
</div>
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 bit of a problem and i need some help. I am learning new things and trying to get some skills with the time spend on learning.
I want to make this picture and forms look the same as the picture. I am posting my code
enter image description here
index.html
<div class="jumbotron">
<div class="row">
<div class="col-md-6 col-sm-6">
<img class="img-responsive" src="img/lqvopodravnenasnimka.jpg" alt="smiley face">
</div> <!--col-md-5-->
<div class="col-md-6 col-sm-6">
<h3>Send Request</h3>
<p id="mainparagraph">Заповядайте в нашия нов хотел Grand Hotel Gergana. Ние Ви предлагаме отлични условия, където можете да прекарате своите ценни свободни дни.</p>
<form name="myForm" action="#" onsubmit="return validateForm()" method="post">
<div class="row">
<div class="col-md-6">
<div class="form-group form-group-sm" style="margin-top:20px;">
<label for="firstname" class="control-label">Name</label> <!--name-->
<br>
<input type="text" class="form-control" id="firstname" style="width:100%;" name="fname">
</div><!-- form-group-->
</div><!--col-md-5-->
<div class="col-md-6">
<div class="form-group form-group-sm" style="margin-top:20px;">
<label for="surname" class="control-label">Surname</label> <!--surname -->
<br>
<input type="text" class="form-control" id="surname" style="width:100%;" name="sname">
</div><!-- form-group-->
</div><!--col-md-5-->
</div><!--row-->
<div class="row">
<div class="col-md-12">
<div class="form-group form-group-sm" style="margin-top:20px;">
<label for="email" class="control-label">Email</label>
<br>
<input type="text" class="form-control" id="email" style="width:100%;" name="mail">
</div>
</div>
</div><!--row-->
<div class="row">
<div class="col-sm-12">
<div class="form-group form-group-sm" style="margin-top:20px;">
<label for="phone" class="control-label">Mobile phone</label>
<!--<span class="glyphicon glyphicon-arrow-right"><p style="color:gray; font-style:italic; font-size:0.7em;">Sample: +352XXXXXXXXX</p> -->
<br>
<input type="phone" class="form-control" id="phone" style="width:100%;" name="mphone">
</div>
</div>
</div><!--row-->
<div class="row">
<div class="col-md-6">
<div class="form-group form-group-sm" style="margin-top:20px;">
<label for="date" class="control-label">Date of birth</label>
<br>
<input type="number" class="form-control" id="number" Placeholder="DD" style="width:55px;" name="day">
<input type="number" class="form-control" id="number" Placeholder="MM" style="width:55px;" name="month">
<input type="number" class="form-control" id="number" Placeholder="YYYY" style="width:90px;" name="year">
</div>
</div><!--col-md-6-->
<div class="col-md-6">
<div class="form-group form-group-sm" >
<label for="text" class="control-label" style="margin-top:20px;">Nationality</label>
<br>
<select class="options" name="cars" style="width:100%;">
<option value="България">България</option>
<option value="Румъния">Румъния</option>
<option value="Гърция">Гърция</option>
<option value="Сърбия">Сърбия</option>
</select>
</div><!--form-group-->
</div>
<div class="col-md-12">
<input type="submit" value="SAMPLE BUTTON">
</div>
</div><!--row-->
</form>
</div><!--col-md-7-->
Its quite a simple fix. You were really close! Firstly with Bootstrap you need to have a container, so that's a class that would be on your main div that holds everything so for this instance it would be your jumbotron div.
<div class="jumbotron container">
This will format 90% of what you are trying to achieve into a neat box where all the cols work in harmony with each other.
As for the input boxes, I see you were having difficulty with your date inputs. This too is an easy fix. Simply add the following code to your css:
#number {
float: left;
}
This will push them close together as seen in your picture.
Working example here - https://codepen.io/anon/pen/MoqRMK
I am sure you are experienced enough to make any other required changes.
Due to the boot strap design, the keyboard tab key is working vertically(col wise) instead of horizontally.
Can I make the keyboard tab key behavior horizontal(default behavior) without changing the design
This is the section of code.
<div class="col-md-4">
<div class="form-group col-md-12">
<span class="col-md-6">
<select ng-model="typeId" required=""><option value="" class="" selected="selected">--SELECT--</option>
<option label="Employment" value="number:2">Employment</option>
<option label="Female" value="number:3">Female</option>
<option label="Food" value="number:4">Food</option>
<option label="Male" value="number:1">Male</option>
</select>
</span>
</div>
<div class="form-group col-md-12" ">
<span class="col-md-6">
<input type="text" name="nameAr" required="" ng-maxlength="250">
</span>
</div>
<div class="form-group col-md-12">
<span class="col-md-6">
<select ng-model="nId" ng-options="non.nId as non.nlity for non in List" ng-invalid-required" name="nationality" id="nationality" required="">
</select>
</span>
</div>
<div class="form-group col-md-12">
</div>
<div class="form-group col-md-12">
<label class="col-md-6" for="profession">Profession:</label>
<span class="col-md-6">
<select ng-model="rpationId" ng-options="ocp.rpationId as ocp.occupation for ocp in occupationList" >\
</select>
</span>
</span>
</div>
</div>
<div class="col-md-4">
<div class="form-group col-md-12" ng-class="{ 'has-error' : regCtrl.userForm.mmpId.$invalid && regCtrl.userForm.mmpId.$dirty }">
<label class="col-md-6" for="mmpId">MMP Id: *</label>
<span class="col-md-6">
<input type="text" name="mmpId" class="form-control ">
</span>
<div class="col-sm-6 error-color ng-scope ng-active" >
<span ng-message="required" class="ng-scope">This field is required</span>
</div>
</div>
<div class="form-group col-md-12" >
<label class="col-md-6" for="name">Name: *</label>
<span class="col-md-6">
<input type="text" name="name" ng-maxlength="250">
</span>
</div>
<div class="form-group col-md-12" >
<label class="col-md-6" for="dob">Date of Birth: *</label>
<span class="col-md-6">
<input type="date" name="dob" ng-maxlength="11">
</span>
</div>
<div class="form-group col-md-12" ng-class="">
<label class="col-md-6" for="contactNo">Contact No: *</label>
<span class="col-md-6">
<input type="number" name="contactNo" required="">
</span>
</div>
</div>
This is because of your grouping of the form elements. You are grouping the elements column wise hence the tab works column wise.
You have grouped 4 form elements in first col-md-4 and the next 4 in the second col-md-4 so default tab control will first cover first col-md-4 elements and then the next col-md-4 elements.
Either use tabindex or change your layout to row wise as below:
<div class="row">
<div class="col-md-4">
<div class="form-group col-md-12">
<input type="text" name="nameAr" required="" ng-maxlength="250">
</div>
</div>
<div class="col-md-4">
<div class="form-group col-md-12">
<input type="text" name="nameAr" required="" ng-maxlength="250">
</div>
</div>
<div class="col-md-4">
<div class="form-group col-md-12">
<input type="text" name="nameAr" required="" ng-maxlength="250">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group col-md-12">
<input type="text" name="nameAr" required="" ng-maxlength="250">
</div>
</div>
<div class="col-md-4">
<div class="form-group col-md-12">
<input type="text" name="nameAr" required="" ng-maxlength="250">
</div>
</div>
<div class="col-md-4">
<div class="form-group col-md-12">
<input type="text" name="nameAr" required="" ng-maxlength="250">
</div>
</div>
</div>
Hope it helps.
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/