Alignment of label and textbox - html

I am facing this issue again with the alignment which I am unable to rectify. I don't know what I am missing out. Please find the plunkr [https://plnkr.co/edit/UD0YZQhgOjIoJ1nqg7sb?p=preview] .Please maximise the plunkr output for the actual output I am getting. Any help people?
Html code:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div ng-controller="headerCtrl">
<div class="container" style="padding-top:20px;">
<div ng-app="TimeSheet" data-ng-controller="headerCtrl" class="container" style="margin-top:60px">
<div ng-show="error" class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<p>{{ error }}</p>
</div>
<!--<p><a data-ng-click="showadd()" href="javascript:;" class="btn btn-primary">Generate Report</a></p>-->
<div class="panel panel-default">
<div class="panel-body">
<section>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="form-horizontal">
<div class="form-group">
<label for="title" class="col-sm-5 control-label">UserID</label>
<div class="col-sm-4">
<select data-ng-model="user.userid" class="form-control" id="title" required>
<option value="" selected="selected">(Select User ID)</option>
<option value="user1">user1</option>
<option value="user2">user2</option>
<option value="user3">user3</option>
<option value="user4">user4</option>
</select>
<!--<input type="text" data-ng-model="user.userid" class="form-control" id="title" placeholder="Enter your User ID" required title="Enter your UserID" />-->
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-5 control-label">Status</label>
<div class="col-sm-4">
Active
<input name="Status" type="radio" data-ng-model="user.ResultStatus" value="Active" required title="Choose status"> In-Active
<input name="Status" type="radio" data-ng-model="user.ResultStatus" value="InActive" required title="Choose status">
</div>
</div>
<div class="form-group">
<label for="startDate" class="col-sm-5 control-label">Date</label>
<div class="col-sm-4">
<input name="startDate" data-ng-model="user.date" id="startDate" class="date-picker" required />
<!--<input type="text" data-ng-model="user.projectid" class="form-control" id="title" placeholder="Enter your Project ID" required title="Enter your ProjectID" />-->
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-4">
<span data-ng-hide="editMode">
<input type="submit" value="Generate" ng-disabled="adduserform.$invalid" data-ng-click="add()" class="btn btn-primary" />
</span>
<span data-ng-show="editMode">
<input type="submit" value="Update" ng-disabled="adduserform.$invalid" data-ng-click="update()" class="btn btn-primary" />
</span>
<input type="button" value="Cancel" data-ng-click="cancel()" class="btn btn-primary" />
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
you can see the alignment issue here in this image below

To make the date input span the whole width, you need the .form-control class on it.
<input name="startDate" data-ng-model="user.date" id="startDate" class="form-control date-picker" required />
Also note that the <input> tag must have a type attribute with it.
You have a container within a container for your timesheet div. Removing the .container class from the timesheet div fixes the alignment issue.
Also, put the <table> in a row and a column:
<div class="row">
<div class="col-md-12">
<!-- Your table here -->
<table class="table table-hover">
...
</table>
</div>
</div>
See it working here.

Related

how to set the width of a float button

this button is affecting everything that is in the same line with it, how do i make it fixed without having it affect the things on the same line with it. the fields are affected by the save button. if the save button is is the same line as the form field, it affects the form field
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<input type="hidden" asp-for="EmployeeCode" value="#EmpCode" />
</div>
<div class="form-group">
<label asp-for="IndustryId" class="control-label"></label>
<select asp-for="IndustryId" class="form-control" asp-items="ViewBag.IndustryId"></select>
</div>
<div class="form-group">
<label asp-for="SubIndustryId" class="control-label"></label>
<select asp-for="SubIndustryId" class="form-control" asp-items="ViewBag.SubIndustryId">
<option selected> - None - </option>
</select>
</div>
<div class="form-group">
<label asp-for="YearsExp" class="control-label"></label>
<input asp-for="YearsExp" class="form-control" />
<span asp-validation-for="YearsExp" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Proficiency" class="control-label"></label>
<input asp-for="Proficiency" class="form-control" />
<span asp-validation-for="Proficiency" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="BusinessArea" class="control-label"></label>
<input asp-for="BusinessArea" class="form-control" />
<span asp-validation-for="BusinessArea" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Feature" class="control-label"></label>
<input asp-for="Feature" class="form-control" />
<span asp-validation-for="Feature" class="text-danger"></span>
</div>
<div class="fixed-bottom">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="text-right" style="margin-bottom:20px;">
<input type="submit" value="Save Changes" class="btn btn-primary" />
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="fixed-bottom">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="text-right" style="margin-bottom:20px;">
<input type="submit" value="Save Changes" class="btn btn-primary" />
</div>
</div>
</div>
</div>
</div>
I've created a preview here: https://www.bootply.com/eItE7SJoQb
Maybe if you were to place the 'things on the same line' that you don't want it to affect..?

Bootstrap col-md-4 inside a col-md-12

I'm trying to have a col-md-4 inside a col-md-12, but it is not working.
HTML:
<form role="form" action="" method="post">
<div class="row">
<div class="col-xs-6 col-md-offset-3">
<div class="col-md-12">
<h3>Information</h3>
<!-- This is fine because I want the name to be full size of the line -->
<div class="form-group">
<label class="control-label">Name</label>
<input maxlength="200" type="text" required="required" class="form-control" placeholder=" Name" />
</div>
<!-- Here I want to break 3 input side by side -->
<!-- Not working. Each rules is in one line -->
<div class="form-group">
<label class="control-label">Rules</label>
<div class="row">
<div class="col-md-12">
<input type="number" required="required" class="col-md-4" placeholder="Rule1" />
<input type="number" required="required" class="col-md-4" placeholder="Rule2" />
<input type="number" required="required" class="col-md-4" placeholder="Rule3" />
</div>
</div>
</div>
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Next</button>
</div>
</div>
</div>
</form>
Does anyone know how can I put the Rules side by side in the row?
Thanks
use
<div class="col-xs-4"></div>
or "col-md-4" xs just to show in this tiny preview
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<form role="form" action="" method="post">
<div class="row">
<div class="col-xs-12 col-md-offset-3">
<div class="col-md-12">
<h3>Information</h3>
<!-- This is fine because I want the name to be full size of the line -->
<div class="form-group">
<label class="control-label">Name</label>
<input maxlength="200" type="text" required="required" class="form-control" placeholder=" Name" />
</div>
<!-- Here I want to break 3 input side by side -->
<!-- Not working. Each rules is in one line -->
<div class="form-group">
<label class="control-label">Rules</label>
<div class="row">
<div class="col-xs-4">
<input type="number" class="form-control" required="required" placeholder="Rule1" />
</div>
<div class="col-xs-4">
<input type="number" class="form-control" required="required" placeholder="Rule2" /> </div>
<div class="col-xs-4">
<input type="number" class="form-control" required="required" placeholder="Rule3" /> </div>
</div>
</div>
</div>
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Next</button>
</div>
</div>
</div>
</form>
</div>

How can I fix this weird line that comes with Boostrap model when having two div with col-lg-6 ?

I have a boostrap model , I see a weird line in it when having two divs with col-lg-6. Can you please tell me why and help me to fix it ?
This is the model code
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Create</h4>
</div>
<form method="post" id="insert_form">
<div class="modal-body">
<div class="col-lg-6">
<div class="form-group">
<label for="Code">Code</label>
<input type="text" class="form-control" id="Code" name="Code" />
</div>
<div class="form-group">
<label for="Name">Name</label>
<input type="text" class="form-control" id="Name" name="Name" />
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label for="CanSale">Sale</label>
<input type="text" class="form-control" id="CanSale" name="CanSale" />
</div>
<div class="form-group">
<label for="Barcode">Barcode</label>
<input type="text" class="form-control" id="Barcode" name="Barcode" />
</div>
<div class="form-group">
<label for="Code">Descriptoin</label>
<input type="text" class="form-control" id="Description" name="Description" />
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<input type="submit" name="insert" id="insert" value="Insert" class="btn btn-success" />
</div>
</form>
</div>
below image red arrows shows the weird line that i am talking about. Please help me fix it.
I forget to place "col" divs inside <div class="row">.
I got it fixed by nesting "col-lg-6" divs inside <div class="row"> </div>

Extend datepicker to start with dropdown using bootstrap

I have a requirement to display Datepicker with Dropdown as a single control, I have tried many samples available on the internet but they do not work for me.
My base code is given below with style in which I have to merge them.
<fieldset>
<div class="form-group">
<label class="col-sm-2 control-label">Date</label>
<div class="col-sm-4">
<select name="Year" class="form-control" ng-model="Year" required>
<option>2016</option>
<option>2015</option>
<option>2014</option>
</select>
<div ng-messages="form.formValidate.select.$error" ng-if="form.formValidate.$submitted" class="text-danger"><span ng-message="required">This field is required</span></div>
<div class="ui-datepicker shadow-clear">
<p class="input-group">
<input type="text" name="date" required="" class="form-control" />
<span class="input-group-btn">
<button type="button" class="btn btn-default"><em class="ion-calendar"></em></button>
</span>
</p>
<div ng-messages="form.formValidate.date.$error" ng-if="form.formValidate.$submitted" class="text-danger"><span ng-message="required">This field is required</span></div>
</div>
</div>
</div>
</fieldset>
Any kind of help would be appreciated.
Thanks in advance!
Edit
Opps! I missed mentioning that both controls should be side by side as displayed in below image.
Edit2
http://www.bootply.com/Tftcr9VVrH
I wrapped the elements in a div with class="form-inline" and put each group of elements into a div with class="form-group". I forked your bootply here
<fieldset>
<div class="form-inline">
<div class="form-group">
<label for="Year">Date</label>
<select name="Year" class="form-control" required="" ng-model="Year">
<option>2016</option>
<option>2015</option>
<option>2014</option>
</select>
<div class="text-danger" ng-if="form.formValidate.$submitted" ng-messages="form.formValidate.select.$error"><span ng-message="required">This field is required</span></div>
</div>
<div class="form-group">
<div class="ui-datepicker shadow-clear">
<div class="input-group">
<input name="date" class="form-control" required="" type="text">
<span class="input-group-btn">
<button class="btn btn-default" type="button"><em class="glyphicon glyphicon-calendar"></em></button>
</span>
</div>
<div class="text-danger" ng-if="form.formValidate.$submitted" ng-messages="form.formValidate.date.$error"><span ng-message="required">This field is required</span></div>
</div>
</div>

Bootstrap inline form with labels above input

I want to create an inline form using bootstrap with labels above input text fields but the result looks so messed up.
This is what i tried:
<form id="form" method="post" class="form-inline" >
<div class="row">
<div class="col-md-2">
<label for="from">from:</label>
<input type="text" class="form-control form-text" />
</div>
<div class="col-md-2">
<label for="to">to:</label>
<input type="text" class="form-control form-text"/>
</div>
<div class="input-group date col-md-2" id="datepicker">
<label for="checkin">check in</label>
<input type="text" class="form-control datepicker" name="processdate" />
<span class="input-group-addon btn"><i class="glyphicon glyphicon-calendar"></i> </span>
</div>
<div class="input-group date col-md-2" id="datepicker">
<label for="checkout">check out</label>
<input type="text" class="form-control datepicker" name="processdate" />
<span class="input-group-addon btn"><i class="glyphicon glyphicon-calendar"></i> </span>
</div>
<div class="col-md-2">
<input type="submit" class="btn btn-default" value="submit"/>
</div>
</div>
</form>
this is what i got:
result
how do i get the submit button to right position and the glyphicons heights the same as the input fields what am i doing wrong?
I made some edits to your html : https://jsfiddle.net/05t4s041/
<form id="form" method="post" class="form-inline" >
<div class="row">
<div class="col-md-2">
<label for="from">from:</label>
<input type="text" class="form-control form-text" />
</div>
<div class="col-md-2">
<label for="to">to:</label>
<input type="text" class="form-control form-text"/>
</div>
<div class="col-md-2">
<label for="checkin">check in</label>
<div class="input-group date" id="datepicker">
<input type="text" class="form-control datepicker" name="processdate" />
<span class="input-group-addon btn"><i class="glyphicon glyphicon-calendar"></i> </span>
</div>
</div>
<div class="col-md-2">
<label for="checkout">check out</label>
<div class="input-group date" id="datepicker">
<input type="text" class="form-control datepicker" name="processdate" />
<span class="input-group-addon btn"><i class="glyphicon glyphicon-calendar"></i> </span>
</div>
</div>
<div class="col-md-2">
<input type="submit" class="btn btn-default" value="submit"/>
</div>
</div>
</form>
you could put divs with bootstrap classes around your label and control like:
<div class="col-md-2">
<div class="row">
<div class="col-md-6">
<label for="from">from:</label>
</div>
<div class ="col-md-6">
<input type="text" class="form-control form-text" />
</div>
</div>
</div>
The row div may be sufficient: it put's elements in a row put I like to put extra bootstrap classes around my controls so I can modify them. For example that the label has a smaller width than the control itself.