HTML/CSS display=table-row alignment - html

I am having trouble getting two components to align in using the <div display='table-cell'>. The first component is being displayed with a gap at the top. I want them to be displayed so that they are aligned.
Here's the JsFiddle: http://jsfiddle.net/66s7x5fr/
Here's the HTML:
<div class="form-group modifierColumn">
<div class="cell">
<select class="form-control input-sm btn-primary">
<option value="Broad">Broad</option>
<option value="Moderate">Moderate</option>
<option value="Single">Single</option>
</select>
</div>
<div class="cell">
<span class="input-group input-group-sm">
<span class="input-group-btn">
<button class="btn btn-primary" type="button"> <i class="fa fa-minus"></i> </button>
</span>
<input class="form-control text-justify" type="text" value="0"> </input>
<span class="input-group-btn">
<button class="btn btn-primary" type="button"> <i class="fa fa-plus"></i> </button>
</span>
</span>
</div>
</div>
Here's the CSS:
.modifierColumn .cell:not(:last-child) {
padding-right: 5px;
}
.cell {
display: table-cell;
}

Similar to nocarrier's response:
.cell {
vertical-align: top;
display: table-cell;
}

Try
.cell {
vertical-align: bottom;
display: table-cell;
}
Somewhat obscure rule. Baffles many. Check Understanding vertical align

Your problem is the the top-padding that the class cell has. Try to use a col-md-x to be more responsive.
<div class="form-group modifierColumn" tabindex="0">
<div class="col-xs-3">
<select class="form-control input-sm btn-primary">
<option value="Broad">Broad</option>
<option value="Moderate">Moderate</option>
<option value="Single">Single</option>
</select>
</div>
<div class="col-xs-4">
<span class="input-group input-group-sm">
<span class="input-group-btn">
<button class="btn btn-primary" type="button"> <i class="fa fa-minus"></i> </button>
</span>
<input class="form-control text-justify" type="text" value="0"> </input>
<span class="input-group-btn">
<button class="btn btn-primary" type="button"> <i class="fa fa-plus"></i> </button>
</span>
</span>
</div>

Related

Bootstrap Column Overlap Before Breakpoint

When collapsing the window before it hits the medium breakpoint, the column containing the select field overlaps the first column with the "heading". Not sure why. Any help would be appreciated.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<div class="row">
<div class="col-md-1">
<span class="h2">Leads</span>
</div>
<div class="col-md-3">
<form>
<input type="hidden" name="status" id="status" value="Today">
<input type="hidden" name="tab" id="tab-status-agent" value="follow_up">
<select name="user_id" id="select-agent" class="form-control" onchange="this.form.submit()">
<option value="">All Team Members</option>
<option value="unassigned">Unassigned</option>
<option value="7">Luke Skywalker</option>
<option value="2">Han Solo</option>
<option value="1">Leia Organa</option>
</select>
</form>
</div>
<div class="col-md-5 text-right">
<form data-remote="false" class="d-inline" id="power-dialer-form" action="/calls/power_dialer" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="authenticity_token" value="vqtLpEeM2kh5MP7nZFhFrfrmJhjm6T3IF++8UGmHpHjZP4E9WSOpIsextGJptcRYPIuDBqVWgDkVYeHOn9uWow==">
<button type="submit" name="commit" value="" class="btn btn-primary" id="add-to-power-dialer" disabled="">
<i class="fas fa-phone" title="Add to power dialer"></i>
</button>
</form>
<div class="btn-group" role="group" aria-label="Basic example">
<a class="btn btn-primary" data-toggle="modal" data-target="#assign-leads" title="Assign leads" href="#">
<span class="fas fa-user-check"></span>
</a> <a class="btn btn-primary" data-toggle="modal" data-target="#new-lead" title="New lead" href="#">
<span class="fas fa-user-plus"></span>
</a> <a class="btn btn-primary" data-toggle="modal" data-target="#import-leads" title="Import leads" href="#">
<span class="fas fa-file-import"></span>
</a>
</div>
</div>
<div class="col-md-3">
<div class="input-group search-bar">
<div class="input-group-prepend">
<div class="input-group-text" id="btnGroupAddon"><i class="fas fa-search"></i></div>
</div>
<input type="search" id="search" class="form-control">
</div>
</div>
</div>
I attempted this setting:
ROW: COL-2 COL-3 COL-4 COL-3
Which fixes the overlap but then the select field is too far away from the heading.
Please try this code i hope it will be worked
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<div class="row">
<div class="col-md-4">
<span class="h2">Leads</span>
<form class="ml-3">
<input type="hidden" name="status" id="status" value="Today">
<input type="hidden" name="tab" id="tab-status-agent" value="follow_up">
<select name="user_id" id="select-agent" class="form-control"
onchange="this.form.submit()">
<option value="">All Team Members</option>
<option value="unassigned">Unassigned</option>
<option value="7">Luke Skywalker</option>
<option value="2">Han Solo</option>
<option value="1">Leia Organa</option>
</select>
</form>
</div>
<div class="col-md-5 text-right">
<form data-remote="false" class="d-inline" id="power-dialer-form" action="/calls/power_dialer" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="authenticity_token" value="vqtLpEeM2kh5MP7nZFhFrfrmJhjm6T3IF++8UGmHpHjZP4E9WSOpIsextGJptcRYPIuDBqVWgDkVYeHOn9uWow==">
<button type="submit" name="commit" value="" class="btn btn-primary" id="add-to-power-dialer" disabled="">
<i class="fas fa-phone" title="Add to power dialer"></i>
</button>
</form>
<div class="btn-group" role="group" aria-label="Basic example">
<a class="btn btn-primary" data-toggle="modal" data-target="#assign-leads" title="Assign leads" href="#">
<span class="fas fa-user-check"></span>
</a> <a class="btn btn-primary" data-toggle="modal" data-target="#new-lead" title="New lead" href="#">
<span class="fas fa-user-plus"></span>
</a> <a class="btn btn-primary" data-toggle="modal" data-target="#import-leads" title="Import leads" href="#">
<span class="fas fa-file-import"></span>
</a>
</div>
</div>
<div class="col-md-3">
<div class="input-group search-bar">
<div class="input-group-prepend">
<div class="input-group-text" id="btnGroupAddon"><i class="fas fa-search"></i></div>
</div>
<input type="search" id="search" class="form-control">
</div>
</div>
</div>

Center Counter Bootstrap Modal

I have a counter with increase decrease button. It's inside a model-content, but I can't center it in the middle of the modal. Can you help me?
https://i.stack.imgur.com/gkoMZ.png
<div class="input-group" style="width:25%;">
<span class="input-group-btn">
<span class="btn btn-white btn-minuse" type="button">-</span>
</span>
<input type="text" class="form-control text-center height-25" value=0 >
<span class="input-group-btn">
<span class="btn btn-red btn-pluss" type="button">+</span>
</span>
</div>
To center it you should use margin: 0 auto. And that will solve your problem
<div class="input-group" style="width:25%; margin: 0 auto;">
<span class="input-group-btn">
<span class="btn btn-white btn-minuse" type="button">-</span>
</span>
<input type="text" class="form-control text-center height-25" value=0>
<span class="input-group-btn">
<span class="btn btn-red btn-pluss" type="button">+</span>
</span>
</div>
Also, avoid using Inline CSS styles. If that didn't help please let me know.

input-prepend create two rows

I'm trying to add two buttons on both sides of the search field, so I did this:
<div id="fixtures-filter">
<div class="input-group-btn">
<div class="input-group-prepend"><button type="button" class="btn btn-light" aria-expanded="false" id="countries-btn">Filters</button></div>
<div class="app-search">
<div class="input-group"><input type="text" class="form-control" placeholder="Search..."><span class="mdi mdi-magnify"></span>
<div class="input-group-append"><button type="button" class="btn btn-light" data-toggle="modal" data-target="#fixtures-filter-modal">Search</button> </div>
</div>
</div>
</div>
</div>
the result is really weird:
This is a JSFIDDLE.
Use an append and prepend. Adjust the borders as needed to make the search icon appear inside the input.
<div class="input-group">
<span class="input-group-prepend">
<button class="btn btn-primary" type="button">
Filters
</button>
</span>
<span class="input-group-prepend">
<div class="input-group-text bg-transparent border-right-0"><i class="fa fa-search"></i></div>
</span>
<input class="form-control py-2 border-left-0 border" type="search" value="..." id="example-search-input">
<span class="input-group-append">
<button class="btn btn-outline-secondary border-left-0 border" type="button">
Search
</button>
</span>
</div>
https://www.codeply.com/go/KJcZWvSsR9
If you are trying to get the filter to be on the same line, you have to move it inside the same parent div as the other inputs:
<div id="fixtures-filter">
<div class="input-group-btn">
<div class="app-search">
<div class="input-group">
<div class="input-group-prepend"><button type="button" class="btn btn-primary" aria-expanded="false" id="countries-btn"><span class="mdi mdi-magnify"></span></button></div>
<input type="text" class="form-control padleft" placeholder="Search...">
<span class="mdi mdi-magnify search-mg"></span>
<div class="input-group-append">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#fixtures-filter-modal">Search</button>
</div>
</div>
</div>
</div>
</div>
CSS added to get the magnifying glass icon to appear in the search input:
#fixtures-filter {
position: relative;
}
span.search-mg {
position: absolute;
z-index: 10;
font-size: 20px;
line-height: 38px;
left: 45px;
}
.padleft {
padding-left: 30px;
}
fiddle: http://jsfiddle.net/5xkbn3o0/

Layout form input bootstrap

I have a problem with layout bootstrap. I want the search button to remain at the end of the line.
Here is my code:
<form id="frmTest" class="form-inline">
<div class="form-group">
<input type="text" name="full_name" class="form-control" id="full_name" placeholder="Name"/>
</div>
<div class="form-group">
<div class="input-group date date-picker" data-date-format="dd-mm-yyyy">
<input type="text" name="start_date" class="form-control" readonly id="start_date" size="8" placeholder="From(Date)">
<span class="input-group-btn">
<button class="btn default" type="button">
<i class="fa fa-calendar"></i>
</button>
</span>
</div>
</div>
<div class="form-group">
<div class="input-group date date-picker" data-date-format="dd-mm-yyyy">
<input type="text" name="end_date" class="form-control" readonly id="end_date" size="8" placeholder="To(Date)">
<span class="input-group-btn">
<button class="btn default" type="button">
<i class="fa fa-calendar"></i>
</button>
</span>
</div>
</div>
<div class="form-group">
<button class="btn btn-primary black" onClick="clearForm(event);" id="btn-reset" >clear</button>
</div>
</form>
<button class="btn btn-warning " id="btn-search">Search</button> //this not part form input
output:
I want the layout like this:
How can this resolved?
1)Place search button into the form.
2) If you don't want to place the search button into the form, then try the below code.
Just, make the form inline.
form {
display: inline;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<form id="frmTest" class="form-inline">
<div class="form-group">
<input type="text" name="full_name" class="form-control" id="full_name" placeholder="Name" />
</div>
<div class="form-group">
<div class="input-group date date-picker" data-date-format="dd-mm-yyyy">
<input type="text" name="start_date" class="form-control" readonly id="start_date" size="8" placeholder="From(Date)">
<span class="input-group-btn">
<button class="btn default" type="button">
<i class="fa fa-calendar"></i>
</button>
</span>
</div>
</div>
<div class="form-group">
<div class="input-group date date-picker" data-date-format="dd-mm-yyyy">
<input type="text" name="end_date" class="form-control" readonly id="end_date" size="8" placeholder="To(Date)">
<span class="input-group-btn">
<button class="btn default" type="button">
<i class="fa fa-calendar"></i>
</button>
</span>
</div>
</div>
<div class="form-group">
<button class="btn btn-primary black" onClick="clearForm(event);" id="btn-reset">clear</button>
</div>
</form>
<button class="btn btn-warning " id="btn-search">Search</button>
Note: View the output in full page mode.

Display input value with suffix in bootstrap

I have an issue that I should display measurment units after a value in input. The problem is that standard Bootstrap's way to create a span is overkill here, because it requires too many space for it. For example:
<div class="input-group margin-bottom">
<span class="input-group-addon input-source-observer"><i class="fa fa-trash fa-fw"></i></span>
<span class="input-group-addon input-source-observer" style="text-align: right">Persist deleted items for</span>
<input type="text" class="form-control" data-parsley-trigger="change" placeholder="1" initial-value="1" value="7" style="text-align: right">
<span class="input-group-addon input-source-observer">days</span>
<span class="input-group-btn">
<input type="button" class="btn btn-default" onclick="restoreInput(event)" value="Recover">
</span>
</div>
Here it looks fine enough, but in other places it looks really ugly. I want something like
How can I do it with HTML5+CSS3 or/and bootstrap features?
By creating a new class you can adjust the properties of your input and input-group-addon:
The HTML:
<div class="input-group margin-bottom">
<span class="input-group-addon input-source-observer"><i class="glyphicon glyphicon-trash"></i></span>
<span class="input-group-addon input-source-observer" style="text-align: right">Persist deleted items for</span>
<input type="text" class="form-control addon-inline" data-parsley-trigger="change" placeholder="1" initial-value="1" value="7" style="text-align: right">
<span class="input-group-addon addon-inline input-source-observer">days</span>
<span class="input-group-btn">
<input type="button" class="btn btn-default" onclick="restoreInput(event)" value="Recover">
</span>
</div>
The CSS
.input-group-addon.addon-inline {
background: #fff;
color: #999;
border-left: none;
padding-left: 0;
}
.input-group .form-control.addon-inline {
border-right: none;
padding-right: 5px;
}
The Results:
http://www.bootply.com/BOTmrMi4jV