Divide spacing in bootstrap group of buttons - html

How to get equal spacing in this group of buttons?
When I add pull-right to the class the search and plus buttons is set to below the search box.
<tr>
<th class="col-md-3">
<small>Firma</small>
<span class="glyphicon glyphicon-sort-by-alphabet glyph_sorting" aria-hidden="true"></span>
<span class="glyphicon glyphicon-sort-by-alphabet-alt glyph_sorting" aria-hidden="true"></span>
</th>
<th class="col-md-3"><small>Plaats</small></th>
<th class="col-md-3"><small>Telefoon</small></th>
<th class="col-md-3">
<form action="" method="post">
<div class="form-group col-xs-8">
<input type="text" class="form-control input-sm" placeholder="Search">
</div>
<button type="submit" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
<button type="button" class="btn btn-sm"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
</form>
</th>
</tr>

Edit based on comment:
Set parent container (form) to flexbox row, and center it's children elements horizontally with even space in-between with justify-content:space-between & vertically with align-items:center.
Override bootstrap's .form-control's padding & margin, which is whats causing the space async between buttons & the search input.
form {
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-items: center;
}
div.form-group {
padding: 0;
margin: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<table>
<tr>
<th class="col-md-3">
<small>Firma</small>
<span class="glyphicon glyphicon-sort-by-alphabet glyph_sorting" aria-hidden="true"></span>
<span class="glyphicon glyphicon-sort-by-alphabet-alt glyph_sorting" aria-hidden="true"></span>
</th>
<th class="col-md-3"><small>Plaats</small></th>
<th class="col-md-3"><small>Telefoon</small></th>
<th class="col-md-3">
<form action="" method="post">
<div class="form-group col-xs-8">
<input type="text" class="form-control input-sm" placeholder="Search">
</div>
<button type="submit" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
<button type="button" class="btn btn-sm"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
</form>
</th>
</tr>
</table>

Related

how to align divs inside a td horizontally?

as shown in the image,things are deranged a bit, maybe its because its inside a td.
is it possible to do that?
<td>
<div class="col">
<div class="input-group text-center">
<div class="input-group-btn">
<button class="btn btn-primary" type="submit" id="button-minus"> - </button>
</div>
<input type="text" class="form-control" value="1" size="1">
<div class="input-group-btn">
<button class="btn btn-primary" type="submit" id="button-plus"> + </button>
</div>
</div> <!-- input-group.// -->
</div> <!-- Col.// -->
</td>
You might try to remove the default Bootstrap padding and margin for td, p, button and try :
td {
padding: 0;
margin: 0;
}
You can place the buttons and form on the same line by adding display: inline-flex to .input-group
.input-group {display: inline-flex}
<td>
<div class="col">
<div class="input-group text-center">
<div class="input-group-btn">
<button class="btn btn-primary" type="submit" id="button-minus"> - </button>
</div>
<input type="text" class="form-control" value="1" size="1">
<div class="input-group-btn">
<button class="btn btn-primary" type="submit" id="button-plus"> + </button>
</div>
</div> <!-- input-group.// -->
</div> <!-- Col.// -->
</td>

How to center-align buttons inside <td>?

enter image description hereI have two button inside my and I need to align it in the center
<td align="center">
<form action="ReplyFound" method="post" class="pull-left">
<a class="btn btn-default "><em class="fa fa-pencil"></em></a>
</form>
<form action="DeleteMessage" method="post" class="pull-left">
<a class="btn btn-danger "><em class="fa fa-trash"></em></a>
</form>
</td>
Try:
display: block;
margin: auto;
Try This :
.divCenter {
width: 100%;
max-width: 960px;
margin: 0 auto;
text-align: center;
}
.pull-left {
display: inline-block;
margin: 5px;
background-color: #000;
color: #fff;
}
<div class="divCenter">
<td align="center">
<form action="ReplyFound" method="post" class="pull-left">
<a class="btn btn-default "><em class="fa fa-pencil">Button1</em></a>
</form>
<form action="DeleteMessage" method="post" class="pull-left">
<a class="btn btn-danger "><em class="fa fa-trash">Button2</em></a>
</form>
</td>
</div>
You can use following html for this
<td class="text-center">
<form action="ReplyFound" method="post" class="btn-block">
<a class="btn btn-default "><em class="fa fa-pencil"></em></a>
</form>
<form action="DeleteMessage" method="post" class="btn-block">
<a class="btn btn-danger "><em class="fa fa-trash"></em></a>
</form>
</td>
Missing closing tag </form>.
If you are not defining width when its width will be wrap content.
<table style="width:100%">
<tr>
<td align="center">
<form action="ReplyFound" method="post" class="pull-left">
<a class="btn btn-default ">Edit</a>
</form>
<form action="DeleteMessage" method="post" class="pull-left">
<a class="btn btn-danger ">Delete</a>
</form>
</td>
</tr>
</table>
You can use this
.centerBtn{
display:inline-block;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<table style="width:100%">
<tr>
<td align="center" >
<div class="centerBtn">
<form action="ReplyFound" method="post" class="pull-left">
<a class="btn btn-default "><em class="fa fa-pencil"></em></a>
</form>
<form action="DeleteMessage" method="post" class="pull-left">
<a class="btn btn-danger "><em class="fa fa-trash"></em></a>
</form>
</div>
</td>
</tr>
</table>

How to remove empty space in a div element?

Here I am providing a screenshot and I outlined the area I wanted to collapse all the way to just right after the last blue buttom, touching it. I outlined the area I wanted to collapse in red. Is there a specific class that will let me do that?
Ty
code:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<div class="panel panel-primary col-md-6">
<div class="row">
<!-- Label -->
<button type="button" class="btn btn-info btn-xs btn-block" id='invoicelabel'><strong>Invoice CP</strong>
</button>
<!-- Invoice CP -->
<div class="btn-group btn-group-vertical col-md-3 test2">
<button class="btn btn-primary btn-sm" type="submit">Total Amount</button>
<button class="btn btn-primary btn-sm" type="submit">Duplicate</button>
<button class="btn btn-primary btn-sm" type="submit">Clear</button>
<button class="btn btn-primary btn-sm" type="submit">Currency</button>
<button class="btn btn-primary btn-sm" type="submit" disabled>.</button>
<button class="btn btn-primary btn-sm" type="submit" disabled>.</button>
</div>
<table class="table table-condensed">
<tbody class="col-md-10 test pull-right">
<tr>
<td class="default" width="20%">
<input type="text" class="btn btn-default btn-sm col-sm-12 floatright" placeholder="Pieces">
</td>
<td class="default" width="35%">
<input type="text" class="btn btn-default btn-sm col-sm-12 floatright" placeholder="Unit Price">
</td>
<td class="default" width="45%">
<input type="text" class="btn btn-default btn-sm col-sm-12 floatright" placeholder="Line Amount">
</td>
</tr>
<tr>
<td class="default" width="20%">
<input type="text" class="btn btn-default btn-sm col-sm-12 floatright" placeholder="Pieces">
</td>
<td class="default" width="35%">
<input type="text" class="btn btn-default btn-sm col-sm-12 floatright" placeholder="Unit Price">
</td>
<td class="default" width="45%">
<input type="text" class="btn btn-default btn-sm col-sm-12 floatright" placeholder="Line Amount">
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
Try checking the CSS height property of the .test or .test2. Probably it is set to a specific value. If you leave it blank, the area will fit to the content.

Angular Datepicker displaying twice in bootstrap modal

I'm new to Angular JS. I was working with Angular JS calendar and am trying to display the angular Datepicker inside Bootstrap modal window. However the Datepicker is displayed twice as shown in the image below.
Here's my modal html code.
<div class="modal-header">
<h3 class="modal-title">{{ vm.event.event.title }}</h3>
</div>
<div class="modal-body" ng-repeat="event in vm.event track by $index">
<h3 class="post-subtitle">
{{event.type}}
</h3>
<table class="table table-bordered">
<thead>
<th>Starts on</th>
<th>Ends on</th>
</thead>
<tbody>
<td>
<p class="input-group" style="max-width: 250px">
<input
type="text"
class="form-control"
readonly
uib-datepicker-popup="dd MMMM yyyy"
ng-model="event.startsAt"
is-open="event.startOpen"
close-text="Close" >
<span class="input-group-btn">
<button
type="button"
class="btn btn-default"
ng-click="vm.object.toggle($event, 'startOpen', event)">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
</p>
<uib-timepicker
ng-model="event.startsAt"
hour-step="1"
minute-step="15"
show-meridian="true">
</uib-timepicker>
</td>
<td>
<p class="input-group" style="max-width: 250px">
<input
type="text"
class="form-control"
readonly
uib-datepicker-popup="dd MMMM yyyy"
ng-model="event.endsAt"
is-open="event.endOpen"
close-text="Close">
<span class="input-group-btn">
<button
type="button"
class="btn btn-default"
ng-click="vm.object.toggle($event, 'endOpen', event)">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
</p>
<uib-timepicker
ng-model="event.endsAt"
hour-step="1"
minute-step="15"
show-meridian="true">
</uib-timepicker>
</td>
</tbody>
</table>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="$close()">OK</button>
</div>

Mozilla Firefox breakes html layout

I have a problem with my page layout in the Mozilla Firefox web-browser. I use bootstrap and quite simple layout.
<form role="form">
<div class="...">
<button class="btn btn-block"></button>
</div>
<div class="entry-placeholder">
<input class="form-control entry" type="text" />
</div>
</form>
<div class="top-buffer-medium"></div>
<div class="dropdown">
...
</div>
<div class="...">
<div class="btn-group">
<span class="btn btn-default">
<span class="glyphicon glyphicon-calendar"></span>
</span>
<span class="btn btn-default">
<span class="glyphicon glyphicon-chevron-left"></span>
</span>
<span class="btn btn-default">
<span class="glyphicon glyphicon-chevron-right"></span>
</span>
</div>
</div>
<div class="btn">
<button class="btn btn-default btn-block"></button>
</div>
<div class="btn">
<button class="btn btn-default btn-block"></button>
</div>
<div class="table">
<table class="table table-hover table-striped">
<tr ng-repeat="...">
<td>
<input type="checkbox" ng-model="isRowSelected" />
</td>
<td></td>
<td></span>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
I use the default bootstrap css and no custom styles for the table. All browsers display my layout properly. And only Firefox brekes it. As you can see the table goes too far right. I thought that the problem is in the body position and tried to add
.body {
-webkit-position: absolute;
-khtml-position: absolute;
-moz-position: absolute;
position: absolute;
}
But it didn't help.
As mentioned in the comments, put all your button in a row div and your table in a different one:
<form>
<div class="row">
<!-- ALL your buttons -->
</div>
<div class="row">
<!-- Your table -->
</div>
</form>
Also body style position: absolute; is just plain wrong.