Issue with datepicker alignment with bootstrap - html

I am trying to align the input controls and facing issue with the alignment.
Here is the code snippet I tried to create the UI design.I need to create UI with rectangle borders/containers around each set of input controls and let me know if we can achieve similar with Booststrap. .
In the above picture the 'calendar icon' is not moving next to 'Date' textbox and pushing other controls which is causing alignment issue.
I have mock up design as well.
<div class="container-fluid bg-3 text-center">
<form>
<div class="form-row">
<div class=" form-group date col-md-2 ">
<label for="DateFrom">Date From</label>
<input type="text" class="form-control" id="DateFrom">
<span class="form-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<div class="form-group date col-md-2">
<label for="Dateto">Date To</label>
<input type="text" class="form-control" id="Dateto">
<span class="form-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<div class=" form-group col-md-2 ">
<label for="DD1">Dropdown1</label>
<select class="form-control" id="DD1">
<option selected value=All>All</option>
<option value=Val1>Val1</option>
<option value=Val2>Val2</option>
</select>
</div>
<div class=" form-group col-md-3 ">
<label for="DD2">Dropdwon2</label>
<select class="form-control" id="DD2">
<option value=All>All</option>
<option value=val1>val1</option>
<option value=val2>val2</option>
</select>
</div>
<div class=" form-group col-md-3 ">
<label for="DD3">Dropdown3</label>
<select class="form-control" id="disposition">
<option value=All>All</option>
</select>
</div>
</div>
<div class="form-row">
<div class=" form-group col-md-2">
<label for="Date">Date</label>
<label class="radio-inline"><input type="radio" name="dateradio" checked>Start Date</label>
<label class="radio-inline"><input type="radio" name="dateradio">End Date</label>
</div>
<div class="form-group col-md-2">
<label for="dd4">Dropdown4</label>
<select class="form-control" id="dd4">
<option selected value=All>All</option>
</select>
</div>
<div class=" form-group col-md-2 ">
<label for="DDl5">Dropdowmn5</label>
<select class="form-control" id="DDl5">
<option value=All>All</option>
</select>
</div>
<div class=" form-group col-md-2">
<label for="Dsply">Display</label>
<label class="radio-inline"><input type="radio" name="Dsply" checked>Val1</label>
<label class="radio-inline"><input type="radio" name="Dsply">Val2</label>
</div>
</div>
<div class="form-row">
<div class=" form-group col-md-2">
<button type="button" class="btn btn-success" >btn1</button>
</div>
<div class="form-group col-md-2">
<button type="button" class="btn btn-success" >btn2</button>
</div>
<div class=" form-group col-md-2 ">
<button type="button" class="btn btn-success" >btn3</button>
</div>
<div class=" form-group col-md-2">
<button type="button" class="btn btn-primary" >btn4</button>
</div>
</div>
</form>
</div>
Please find mock up design and expected output
Could you please let me know how to fix alignment and move 'calendar icon' next/inside-right to date textbox and get the borders around input controls.

I'm gonna try to answer first about the 'calendar icon'.
You need to make css that gonna show icon in background and push text I would do it like this:
#icon {
height: 40px;
margin-top: 10px;
border: 1px solid #e6e6e6;
padding-left: 40px;
padding-right: 50px;
background: #f5f5f5 url(http://i.imgur.com/5xD8KRw.png);
background-repeat: no-repeat;
background-position: left 10px center;
}
<input type="text" id="icon" value="input">
If you need to use only Bootstrap then I would suggest to use <span> with bootstrap class input-group-addon and put <i> tag with icon inside it.
For example:
<form>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="email" type="text" class="form-control" name="email" placeholder="Email">
</div>
</form>
So the output should be something like this:
And for this you need to find the right size of column in Bootstrap so basically your col-md-2 if you change the number to 4,3,5,8 (col-md-4) it's gonna make different size of column in row so you can play with it.
Other changes:
- for new line you can use HTML tag <br />
- and to align radio buttons use class text-left
<div class="container-fluid bg-3 text-center">
<form>
<div class="form-row">
<div class=" form-group date col-md-3 ">
<label for="DateFrom">Date From</label>
<input type="text" class="form-control" id="DateFrom">
<span class="form-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<div class="form-group date col-md-3">
<label for="Dateto">Date To</label>
<input type="text" class="form-control" id="Dateto">
<span class="form-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<div class=" form-group col-md-2 ">
<label for="DD1">Dropdown1</label>
<select class="form-control" id="DD1">
<option selected value=All>All</option>
<option value=Val1>Val1</option>
<option value=Val2>Val2</option>
</select>
</div>
<div class=" form-group col-md-2 ">
<label for="DD2">Dropdwon2</label>
<select class="form-control" id="DD2">
<option value=All>All</option>
<option value=val1>val1</option>
<option value=val2>val2</option>
</select>
</div>
<div class=" form-group col-md-2 ">
<label for="DD3">Dropdown3</label>
<select class="form-control" id="disposition">
<option value=All>All</option>
</select>
</div>
</div>
<div class="form-row">
<div class=" form-group col-md-4 text-left">
<label for="Date">Date</label>
<br />
<label class="radio-inline"><input type="radio" name="dateradio" checked>Start Date</label>
<label class="radio-inline"><input type="radio" name="dateradio">End Date</label>
</div>
<div class="form-group col-md-3">
<label for="dd4">Dropdown4</label>
<select class="form-control" id="dd4">
<option selected value=All>All</option>
</select>
</div>
<div class=" form-group col-md-3 ">
<label for="DDl5">Dropdowmn5</label>
<select class="form-control" id="DDl5">
<option value=All>All</option>
</select>
</div>
<div class=" form-group col-md-2 text-left">
<label for="Dsply">Display</label>
<br />
<label class="radio-inline"><input type="radio" name="Dsply" checked>Val1</label>
<label class="radio-inline"><input type="radio" name="Dsply">Val2</label>
</div>
</div>
<div class="form-row">
<div class=" form-group col-md-2">
<button type="button" class="btn btn-success" >btn1</button>
</div>
<div class="form-group col-md-2">
<button type="button" class="btn btn-success" >btn2</button>
</div>
<div class=" form-group col-md-2 ">
<button type="button" class="btn btn-success" >btn3</button>
</div>
<div class=" form-group col-md-2">
<button type="button" class="btn btn-primary" >btn4</button>
</div>
</div>
</form>
</div>

Related

input and select tag cannot be clicked

I don't know if there is some problem but I can't click on an input and a select tag, i tried everything on the code, I made changes and nothing, nothing solves it, the whole code is below
.mt-35 {
margin-top: 35px;
}
` .mb-35 {
margin-bottom: 35px;
}
.fs-90 {
font-size: 90%;
}
.pd-15 {
padding: 15;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="row">
<div class="col-md-offset-3 col-md-6 col-xs-6">
<div class="row">
<div class="col-xs-12 col-md-12 mt-35 pd-15">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Registro de Publicaciones</h3>
</div>
<div class="panel-body">
<form class="form-horizontal">
<label class="col-md-4 fs-90">ID Converis</label>
<label class="col-md-offset-2 col-md-4 fs-90">Año de publicación</label>
<div class="col-md-6 mb-35">
<input type="text" class="form-control" placeholder="ID Converis">
</div>
<div class="col-md-6 mb-35">
<input type="text" class="form-control" placeholder="Año de publicación">
</div>
<label class="col-md-4 fs-90">DOI</label>
<label class="col-md-offset-2 col-md-4 fs-90">Autores</label>
<div class="col-md-6 mb-35">
<input type="text" class="form-control" placeholder="DOI">
</div>
<div class="col-md-6">
<select class="form-control" multiple size="3" style="margin-bottom: 35px;">
<option value="1">AUTOR</option>
<option value="2">AUTOR</option>
<option value="3">AUTOR</option>
<option value="4">AUTOR</option>
<option value="5">AUTOR</option>
<option value="6">AUTOR</option>
</select>
</div>
<label class="col-md-4 fs-90">Tipo de publicación</label>
<label class="col-md-offset-2 col-md-4">Hola</label>
<div class="col-md-6 mb-35">
<select class="form-control">
<option value="1">Artículo</option>
<option value="2">Revisión</option>
<option value="3">Material editorial</option>
<option value="4">Reporte de caso</option>
<option value="5">Carta</option>
<option value="6">Libro</option>
<option value="7">Capítulo de Libro</option>
<option value="8">Resumen</option>
<option value="9">Presentación</option>
</select>
</div>
<div class="col-md-6 mb-35">
<input type="text" class="form-control" style="visibility: hidden;">
</div>
<div class="checkbox col-md-offset-3">
<label><input type="checkbox" value="">Colaboración Nacional</label>
</div>
<div class="checkbox col-md-offset-3">
<label><input type="checkbox" value="">Colaboración Internacional</label>
</div>
<div class="checkbox col-md-offset-3">
<label><input type="checkbox" value="">Colaboración UC</label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" id="SaveCategory">
<i class="fa fa-save"></i> Grabar
</button>
<button type="button" class="btn btn-secondary">
<i class="fa fa-window-close"></i> Cerrar
</button>
</div>
</div>
</div>
</div>
</div>
</div>
I need this for today and I dont know what the problem is
your div named ' checkbox col-md-offset-3 ' is on the top of your select box " Año de categoria "
try remove position : relative from the nested checkbox class or try to add " position: relative; z-index:10; " on the nested col-md-6 mb-35
.mt-35 {
margin-top: 35px;
}
.mb-35 {
margin-bottom: 35px;
}
.fs-90 {
font-size: 90%;
}
.pd-15 {
padding: 15;
}
.clickfix .col-md-6{position: relative:z-index:10}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="row">
<div class="col-md-offset-3 col-md-6 col-xs-6">
<div class="row">
<div class="col-xs-12 col-md-12 mt-35 pd-15">
<div class="panel panel-primary clickfix">
<div class="panel-heading">
<h3 class="panel-title">Registro de Publicaciones</h3>
</div>
<div class="panel-body">
<form class="form-horizontal">
<label class="col-md-4 fs-90">ID Converis</label>
<label class="col-md-offset-2 col-md-4 fs-90">Año de publicación</label>
<div class="col-md-6 mb-35">
<input type="text" class="form-control" placeholder="ID Converis">
</div>
<div class="col-md-6 mb-35">
<input type="text" class="form-control" placeholder="Año de publicación">
</div>
<label class="col-md-4 fs-90">DOI</label>
<label class="col-md-offset-2 col-md-4 fs-90">Autores</label>
<div class="col-md-6 mb-35">
<input type="text" class="form-control" placeholder="DOI">
</div>
<div class="col-md-6">
<select class="form-control" multiple size="3" style="margin-bottom: 35px;">
<option value="1">AUTOR</option>
<option value="2">AUTOR</option>
<option value="3">AUTOR</option>
<option value="4">AUTOR</option>
<option value="5">AUTOR</option>
<option value="6">AUTOR</option>
</select>
</div>
<label class="col-md-4 fs-90">Tipo de publicación</label>
<label class="col-md-offset-2 col-md-4">Hola</label>
<div class="col-md-6 mb-35">
<select class="form-control">
<option value="1">Artículo</option>
<option value="2">Revisión</option>
<option value="3">Material editorial</option>
<option value="4">Reporte de caso</option>
<option value="5">Carta</option>
<option value="6">Libro</option>
<option value="7">Capítulo de Libro</option>
<option value="8">Resumen</option>
<option value="9">Presentación</option>
</select>
</div>
<div class="col-md-6 mb-35">
<input type="text" class="form-control" style="visibility: hidden;">
</div>
<div class="checkbox col-md-offset-3">
<label><input type="checkbox" value="">Colaboración Nacional</label>
</div>
<div class="checkbox col-md-offset-3">
<label><input type="checkbox" value="">Colaboración Internacional</label>
</div>
<div class="checkbox col-md-offset-3">
<label><input type="checkbox" value="">Colaboración UC</label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" id="SaveCategory">
<i class="fa fa-save"></i> Grabar
</button>
<button type="button" class="btn btn-secondary">
<i class="fa fa-window-close"></i> Cerrar
</button>
</div>
</div>
</div>
</div>
</div>
</div>

How to have a space between the two buttons? And how to align them to center

I'm using bootstrap from getbootstrap.com. I want to have a space between the SAVE and CLEAR button. I also want them to align center to be proportioned on the textboxes. How can I achieve that?
<div class="form-group">
<label for="trucktype" class="col-sm-2">Truck Type</label>
<div class="col-sm-4">
<select id="trucktype" name="trucktype" class="form-control" tabindex="2">
<option value="volvo">Service Wheels</option>
<option value="saab">Boom Truck</option>
<option value="mercedes">Crane Truck</option>
<option value="audi">Pole Trailer Truck</option>
</select>
</div>
</div>
<div class="form-group">
<label for="truckloadcapacity" class="col-sm-2">Truck load capacity</label>
<div class="col-sm-4"><input type="text" name="truckloadcapacity" id="truckloadcapacity" class="form-control" tabindex="3"></div>
</div>
<div class="form-group">
<label for="truckdesc" class="col-sm-2">Truck Description:</label>
<div class="col-sm-4"><textarea class="form-control" rows="3" id="truckdesc" tabindex="4"></textarea></div>
</div>
<div class="form-group">
<label for="truckphoto" class="col-sm-2">Truck Photo</label>
<div class="col-sm-4"><input type="file" name="file" id="truckphoto" class="form-control" tabindex="5"></div>
</div>
<!-- BUTTONS start -->
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<input class="btn-primary btn-lg col-sm-4" type="submit" value="Save">
<input type="reset" class="btn-default btn-lg col-sm-4" name="clear" value="Clear">
</div>
</div>
</div>
<!-- BUTTONS end -->
</form>
may be you are looking for this class="text-center" will do a trick, and some CSS for spacing
.btn-spacing
{
margin-right: 5px;
margin-bottom: 5px !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<div class="form-group">
<label for="trucktype" class="col-sm-2">Truck Type</label>
<div class="col-sm-4">
<select id="trucktype" name="trucktype" class="form-control" tabindex="2">
<option value="volvo">Service Wheels</option>
<option value="saab">Boom Truck</option>
<option value="mercedes">Crane Truck</option>
<option value="audi">Pole Trailer Truck</option>
</select>
</div>
</div>
<div class="form-group">
<label for="truckloadcapacity" class="col-sm-2">Truck load capacity</label>
<div class="col-sm-4"><input type="text" name="truckloadcapacity" id="truckloadcapacity" class="form-control" tabindex="3"></div>
</div>
<div class="form-group">
<label for="truckdesc" class="col-sm-2">Truck Description:</label>
<div class="col-sm-4"><textarea class="form-control" rows="3" id="truckdesc" tabindex="4"></textarea></div>
</div>
<div class="form-group">
<label for="truckphoto" class="col-sm-2">Truck Photo</label>
<div class="col-sm-4"><input type="file" name="file" id="truckphoto" class="form-control" tabindex="5"></div>
</div>
<!-- BUTTONS start -->
<div class="row">
<div class="col-sm-4">
<div class="form-group btn-block text-center">
<input class="btn-primary btn-lg col-sm-4 btn-spacing " type="submit" value="Save">
<input type="reset" class="btn-default btn-lg btn-spacing col-sm-4" name="clear" value="Clear">
</div>
</div>
</div>
<!-- BUTTONS end -->
For the last form-group class rename it to form-group1 and in the CSS put this. .form-group {text-align:center;}. Also, if you want space between those two buttons, do this. .btn-primary btn-lg col-sm-4 {margin:10px;}
here is an example. jsFiddle
To add space between clear and submit button you can add below CSS.
.form-group .btn-primary {
margin-right:10px;
}

How to maintain the width after adding icon next to dropdown list

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

Div class row render differently on chrome and firefox

I have a problem with <div>, as you can see :
firefox display:
chrome display:
html structure :
<div class="row">
<div class="form-group col-xs-12 col-sm-4">
<input type="text" name="from_area" class="form-control input-lg typeahead typeahead-area-tariff" id="from_area" placeholder="Origin" />
</div>
<div class="form-group col-xs-12 col-sm-4">
<input type="text" name="to_area" class="form-control input-lg typeahead typeahead-area-tariff" id="to_area" placeholder="Destination" />
</div>
<div class="form-group col-xs-12 col-sm-4">
<div class="input-group">
<input type="number" name="weight" class="form-control input-lg" id="weight" placeholder="Weight" />
<span class="input-group-addon">Kg</span>
</div>
</div>
<div class="form-group col-xs-12 col-sm-4">
<div class="input-group">
<input type="number" name="length" class="form-control input-lg" id="length" placeholder="Length" />
<span class="input-group-addon">Cm</span>
</div>
</div>
<div class="form-group col-xs-12 col-sm-4">
<div class="input-group">
<input type="number" name="width" class="form-control input-lg" id="width" placeholder="Width" />
<span class="input-group-addon">Cm</span>
</div>
</div>
<div class="form-group col-xs-12 col-sm-4">
<div class="input-group">
<input type="number" name="height" class="form-control input-lg" id="height" placeholder="Height" />
<span class="input-group-addon">Cm</span>
</div>
</div>
<div class="form-group col-xs-12 col-sm-4 col-sm-offset-4 text-center">
<button type="submit" class="btn btn-primary btn-lg btn-block" tabindex="7"><span class="fi flaticon-search"></span> Search </button>
</div>
</div>
I am using <div class="col-sm-4"> but when I see it on firefox, input text "Width" breaks to a new line. Please help :(
[SOLVED] Added <div class="clearfix"></div> after the third input text.
Reference

Bootstrap icon not aligning with input

I am working on a date range control and i want to append icon at the end of the input box but it shows up in new line.
I want all controls like location, start date, end date etc.. in one row for screen larger than 768px and calendar icon appended at the end of start & end input control like it is in the shown on codepen.
Example: http://codepen.io/anon/pen/pggjax
<div class="row">
<div class="input-daterange input-group" id="datepicker">
<div class="form-group">
<div class="col-xs-2">
<label>Location One </label>
<select id="location1">
<option value="1 ">Value1</option>
</select>
</div>
<div class="col-xs-2">
<label>Location Two </label>
<select id="location2">
<option value="1 ">Value1</option>
</select>
</div>
<div class="col-xs-4 ">
<label>Start </label>
<input type="text " class="input-sm form-control " name="start " />
<span class="input-group-addon add-on "><span class="glyphicon glyphicon-calendar "></span></span>
</div>
<div class="col-xs-4 ">
<label>End </label>
<input type="text " class="input-sm form-control " name="start " />
<span class="input-group-addon add-on "><span class="glyphicon glyphicon-calendar "></span></span>
</div>
<div class="col-xs-2">
<button name="submit">SUBMIT</button>
</div>
</div>
</div>
</div>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="input-daterange input-group" id="datepicker">
<div class="form-group">
<div class=" col-md-2 col-xs-12">
<label>Location One </label>
<select id="location1">
<option value="1 ">Value1</option>
</select>
</div>
<div class="col-md-2 col-xs-12">
<label>Location Two </label>
<select id="location2">
<option value="1 ">Value1</option>
</select>
</div>
<div class="col-md-3 col-xs-12 ">
<div class="input-group">
<input type="text" class="form-control" placeholder="Start Date" aria-describedby="basic-addon2">
<span class="input-group-addon glyphicon glyphicon-calendar" id="basic-addon2"></span>
</div>
</div>
<div class=" col-md-3 col-xs-12">
<div class="input-group">
<input type="text" class="form-control" placeholder="end Date" aria-describedby="basic-addon2">
<span class="input-group-addon glyphicon glyphicon-calendar" id="basic-addon2"></span>
</div>
<!-- <label>End </label>
<input type="text " class="input-sm form-control " name="start " />
<span class="input-group-addon add-on "><span class="glyphicon glyphicon-calendar "></span></span>-->
</div>
<div class="col-md-2 col-xs-12">
<button name="submit">SUBMIT</button>
</div>
</div>
</div>
</div>
<p></p>
<p>
Example
<div class="form-group ">
<label class="col-xs-3 control-label ">Date</label>
<div class="col-xs-5 date ">
<div class="input-group input-append date " id="dateRangePicker ">
<input type="text " class="form-control " name="date " />
<span class="input-group-addon add-on "><span class="glyphicon glyphicon-calendar "></span></span>
</div>
</div>
</div>
</p>
First i would remove input type class input-sm then instead of span class input-group-addon add-on i would add input-group-btn then for the select values use form-group with class form-control instead
<div class="row">
<div class="input-daterange input-group" id="datepicker">
<div class="form-group">
<div class="col-xs-2">
<div class="form-group">
<label for="location1">Location One</label>
<select class="form-control" id="location1">
<option value="1">Value1</option>
</select>
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label for="location2">Location Two</label>
<select class="form-control" id="location2">
<option value="1">Value1</option>
</select>
</div>
</div>
<div class="col-xs-3">
<label>Start </label>
<div class="input-group">
<input type="text" class="form-control" name="start ">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<span class="glyphicon glyphicon-calendar"></span>
</button>
</span>
</div>
</div>
<div class="col-xs-3">
<label>End </label>
<div class="input-group">
<input type="text" class=" form-control" name="start ">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<span class="glyphicon glyphicon-calendar"></span>
</button>
</span>
</div>
</div>
<div class="col-xs-2 btn-group-vertical">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</div>
</div>