Set bootstrap spacing for all nested items - html

Say I have this snipped of HTML code:
<div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary"><span class="oi oi-media-step-backward" title="Rewind" aria-hidden="true"></span></button>
<button type="button" class="btn btn-secondary"><span class="oi oi-media-play" title="Play" aria-hidden="true"></span></button>
<button type="button" class="btn btn-secondary"><span class="oi oi-media-pause" title="Pause" aria-hidden="true"></span></button>
</div>
<button type="button" class="btn btn-danger"><span class="oi oi-media-record" title="Pause" aria-hidden="true"></span></button>
<button type="button" class="btn btn-warning">Clear</button>
</div>
I would like any item inside the outer div have an horizontal margin of 3.
The only way I know is to add me-3 to the class of each item (the button group and the two other buttons). But I have to remember to add this for any other item I'm going to add.
I tried to add this to the outer div, but of course it refers to the next sibling div (if any).
Is there a way to set this margin in the outer div, but to be applied to the nested elements?

JS Solution
Iterate over all of the outer div children, and setAttribute class `me-3` to each one:
let outerDiv = document.querySelector(".btn-group")
for (let i = 0; i < outerDiv.childNodes.length; i++) {
console.log(outerDiv.childNodes[i])
if (i % 2 == 1) {
outerDiv.childNodes[i].setAttribute("class", "me-3");
}
}
<div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary"><span class="oi oi-media-step-backward" title="Rewind" aria-hidden="true"></span></button>
<button type="button" class="btn btn-secondary"><span class="oi oi-media-play" title="Play" aria-hidden="true"></span></button>
<button type="button" class="btn btn-secondary"><span class="oi oi-media-pause" title="Pause" aria-hidden="true"></span></button>
</div>
<button type="button" class="btn btn-danger"><span class="oi oi-media-record" title="Pause" aria-hidden="true"></span></button>
<button type="button" class="btn btn-warning">Clear</button>
</div>
CSS Solution
Similar to the JS solution, use `>` to iterate over all the children of `.btn-group`:
.btn-group > button {
margin-left: 3px;
margin-right: 3px;
}
<div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary"><span class="oi oi-media-step-backward" title="Rewind" aria-hidden="true"></span></button>
<button type="button" class="btn btn-secondary"><span class="oi oi-media-play" title="Play" aria-hidden="true"></span></button>
<button type="button" class="btn btn-secondary"><span class="oi oi-media-pause" title="Pause" aria-hidden="true"></span></button>
</div>
<button type="button" class="btn btn-danger"><span class="oi oi-media-record" title="Pause" aria-hidden="true"></span></button>
<button type="button" class="btn btn-warning">Clear</button>
</div>
I personally recommend the CSS solution as you can change the margin left and right to your liking.

Related

Put sticky hyphens in text input

I need to put sticky hyphens in a text input. I attached an image of what I need. I have marked in red what should be fixed. The first hyphen should be after three number gaps, the next after two gaps, and so on.
The numbers appear as I click on each number but I want the dashes to appear by default.
I have tried to do it with a span but I have not succeeded.
<div class="row">
<p id="p" style="font-size: 30px;">Introduzca ubicaciĆ³n:<input style="margin-left: 10px; font-size: 30px;"
type="text" [value]="codeNum" id="code" placeholder="___-__-__-__-__">
<button type="button" style="margin-left: 10px; font-size: 30px; border: white 3px solid;"
class="btn btn-dark btn-lg" (click)="clear()">Borrar</button>
<button type="button" style="margin-left: 10px; font-size: 30px; border: white 3px solid;"
class="btn btn-dark btn-lg" (click)="allClear()">Borrar todo</button>
</p>
</div>
</div>
<div class="calculator-keys">
<button type="button" class="btn btn-light waves-effect" (click)="pressNum('0')" value="0">0</button>
<button type="button" class="btn btn-light waves-effect" (click)="pressNum('1')" value="1">1</button>
<button type="button" class="btn btn-light waves-effect" (click)="pressNum('2')" value="2">2</button>
<button type="button" class="btn btn-light waves-effect" (click)="pressNum('3')" value="3">3</button>
<button type="button" class="btn btn-light waves-effect" (click)="pressNum('4')" value="4">4</button>
<button type="button" class="btn btn-light waves-effect" (click)="pressNum('5')" value="5">5</button>
<button type="button" class="btn btn-light waves-effect" (click)="pressNum('6')" value="6">6</button>
<button type="button" class="btn btn-light waves-effect" (click)="pressNum('7')" value="7">7</button>
<button type="button" class="btn btn-light waves-effect" (click)="pressNum('8')" value="8">8</button>
<button type="button" class="btn btn-light waves-effect" (click)="pressNum('9')" value="9">9</button>
</div>
Thank you
If you're open to using packages there's some out there that might fit your needs. E.g. ngx-mask
npm i --save ngx-mask
then you can do
<input type="text" mask="000-00-00-00-00" [(ngModel)]="codeNum">
OR
<p>{{ codeNum | mask: '000-00-00-00-00' }}</p>
Example: https://stackblitz.com/edit/angular-ngx-mask-example-zd89hh?file=src%2Fapp%2Fapp.component.html

Bootstrap I want to have a five column layout on desktop but two columns on mobile

I want 20 buttons in 4x5 fashion on desktop but on mobile 10x2 fashion. Here is my jfiddle
<div class="container">
<div class="col-md-12">
<button type="button" style="background-color:white" class="btn btn-default btn-square">white</button>
<button type="button" style="background-color:#F7F6E4" class="btn btn-default btn-square">Beige</button>
<button type="button" style="background-color:#3BA6F8" class="btn btn-default btn-square">Blau</button>
<button type="button" style="background-color:#F36660" class="btn btn-default btn-square">Rot</button>
<button type="button" style="background-color:#FDFCEA" class="btn btn-default btn-square">Creme</button>
</div>
<div class="col-md-12">
<button type="button" style="background-color:#DBDBDB" class="btn btn-default btn-square">Graue</button>
<button type="button" style="background-color:#E6C08E" class="btn btn-default btn-square">Eiche</button>
<button type="button" style="background-color:#358B9F" class="btn btn-default btn-square">Petrol</button>
<button type="button" style="background-color:#FF7ECD" class="btn btn-default btn-square">Rosa</button>
<button type="button" style="background-color:#C9C9C9" class="btn btn-default btn-square">Silber</button>
</div>
<div class="col-md-12">
<button type="button" style="background-color:#505558;color:white;" class="btn btn-default btn-square">Anthrazit</button>
<button type="button" style="background-color:C39881" class="btn btn-default btn-square">Taupe</button>
<button type="button" style="background-color:#569A9E" class="btn btn-default btn-square">Trukis</button>
<button type="button" style="background-color:#A03A97" class="btn btn-default btn-square">Lila</button>
<button type="button" style="background-color:#FFDB53" class="btn btn-default btn-square">Gold</button>
</div>
<div class="col-md-12">
<button type="button" style="background-color:#2E2E2E;color:white;" class="btn btn-default btn-square">Schwarz</button>
<button type="button" style="background-color:#A16340" class="btn btn-default btn-square">Braun</button>
<button type="button" style="background-color:#C9DDA8" class="btn btn-default btn-square">Grun</button>
<button type="button" style="background-color:#FFB24A" class="btn btn-default btn-square">Orange</button>
<button type="button" style="background-color:#FFFD5E" class="btn btn-default btn-square">Gelb</button>
</div>
</div>
I could not find anything useful online. I am not using any trick here. Basically I am using button sizes so that it appears in 5 column and then it should appear in 2 column on mobile, but it does not work.
If you want to write less code and avoid so many col-* classes...Use Flexbox
Updated Fiddle
Stack Snippet
.btn-row {
display: flex;
flex-wrap: wrap;
}
.btn.btn-square {
flex: 0 0 calc(20% - 10px);
border-radius: 0;
margin: 5px;
}
#media (max-width:576px) {
.btn.btn-square {
flex: 0 0 calc(50% - 10px);
}
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<h1 class="text-center">Bootstrap Buttons</h1>
<div class="container">
<div class="btn-row">
<button type="button" style="background-color:white" class="btn btn-default btn-square col-md">white</button>
<button type="button" style="background-color:#F7F6E4" class="btn btn-default btn-square">Beige</button>
<button type="button" style="background-color:#3BA6F8" class="btn btn-default btn-square">Blau</button>
<button type="button" style="background-color:#F36660" class="btn btn-default btn-square">Rot</button>
<button type="button" style="background-color:#FDFCEA" class="btn btn-default btn-square">Creme</button>
<button type="button" style="background-color:#DBDBDB" class="btn btn-default btn-square">Graue</button>
<button type="button" style="background-color:#E6C08E" class="btn btn-default btn-square">Eiche</button>
<button type="button" style="background-color:#358B9F" class="btn btn-default btn-square">Petrol</button>
<button type="button" style="background-color:#FF7ECD" class="btn btn-default btn-square">Rosa</button>
<button type="button" style="background-color:#C9C9C9" class="btn btn-default btn-square">Silber</button>
<button type="button" style="background-color:#505558;color:white;" class="btn btn-default btn-square">Anthrazit</button>
<button type="button" style="background-color:C39881" class="btn btn-default btn-square">Taupe</button>
<button type="button" style="background-color:#569A9E" class="btn btn-default btn-square">Trukis</button>
<button type="button" style="background-color:#A03A97" class="btn btn-default btn-square">Lila</button>
<button type="button" style="background-color:#FFDB53" class="btn btn-default btn-square">Gold</button>
<button type="button" style="background-color:#2E2E2E;color:white;" class="btn btn-default btn-square">Schwarz</button>
<button type="button" style="background-color:#A16340" class="btn btn-default btn-square">Braun</button>
<button type="button" style="background-color:#C9DDA8" class="btn btn-default btn-square">Grun</button>
<button type="button" style="background-color:#FFB24A" class="btn btn-default btn-square">Orange</button>
<button type="button" style="background-color:#FFFD5E" class="btn btn-default btn-square">Gelb</button>
</div>
</div>
Using bootstrap3
With bootstrap3 you have to use col-offset class to align 5 elements in a row.
Fiddle Link
What you want is custom. The only question is: do you want this change in columns widths to apply to all pages/columns or to a particular section of your site?
For site-wide changing number of columns, go to https://getbootstrap.com/docs/3.3/customize/#grid-system, change 12 to 10 and download the result.
If you only want it applying on a particular section, first of all add a .row between .container and .col-*-* (it's quite important). Secondly, add a class to your .row, to distinguish it from other .rows in your website. For this example, I used the class 10-cols:
And add this to your CSS, to override the width of those cols:
.\31\30-cols > * {
width: 50%;
}
#media (min-width: 992px) {
.\31\30-cols > * {
width: 20%;
}
}
However, there still seems to be a logical problem. You say you want the buttons divided as: 5 x 4 on large and 2 x 10 on small. Great. Let's take the contents of each of your columns from large and arrange them nicely in two columns on mobile. We put first, third, and fifth columns on left and second and fourth on right. But you want the contents of 5th to be divided in both columns, right?
So you probably want to put all your buttons inside one single element and either use flexbox or CSS columns to display them as you want.
So you need to display this column as full width on mobile and further divide its contents in two columns:
.\31\30-cols > [class^="col-md"] {
width: 50%;
}
.\31\30-cols > .col-xs-12 {
width: 100%;
}
#media (min-width: 992px) {
.\31\30-cols > [class^="col-md"] {
width: 20%;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="container">
<div class="row 10-cols">
<div class="col-md-12 col-xs-6">
<button type="button" style="background-color:white" class="btn btn-block btn-default btn-square">white</button>
<button type="button" style="background-color:#F7F6E4" class="btn btn-block btn-default btn-square">Beige</button>
<button type="button" style="background-color:#3BA6F8" class="btn btn-block btn-default btn-square">Blau</button>
<button type="button" style="background-color:#F36660" class="btn btn-block btn-default btn-square">Rot</button>
</div>
<div class="col-md-12 col-xs-6">
<button type="button" style="background-color:#FDFCEA" class="btn btn-block btn-default btn-square">Creme</button>
<button type="button" style="background-color:#DBDBDB" class="btn btn-block btn-default btn-square">Graue</button>
<button type="button" style="background-color:#E6C08E" class="btn btn-block btn-default btn-square">Eiche</button>
<button type="button" style="background-color:#358B9F" class="btn btn-block btn-default btn-square">Petrol</button>
</div>
<div class="col-md-12 col-xs-6">
<button type="button" style="background-color:#FF7ECD" class="btn btn-block btn-default btn-square">Rosa</button>
<button type="button" style="background-color:#C9C9C9" class="btn btn-block btn-default btn-square">Silber</button>
<button type="button" style="background-color:#505558;color:white;" class="btn btn-block btn-default btn-square">Anthrazit</button>
<button type="button" style="background-color:C39881" class="btn btn-block btn-default btn-square">Taupe</button>
</div>
<div class="col-md-12 col-xs-6">
<button type="button" style="background-color:#569A9E" class="btn btn-block btn-default btn-square">Trukis</button>
<button type="button" style="background-color:#A03A97" class="btn btn-block btn-default btn-square">Lila</button>
<button type="button" style="background-color:#FFDB53" class="btn btn-block btn-default btn-square">Gold</button>
<button type="button" style="background-color:#2E2E2E;color:white;" class="btn btn-block btn-default btn-square">Schwarz</button>
</div>
<div class="col-md-12 col-xs-12">
<div class="row">
<div class="col-xs-6 col-md-12">
<button type="button" style="background-color:#A16340" class="btn btn-block btn-default btn-square">Braun</button>
<button type="button" style="background-color:#C9DDA8" class="btn btn-block btn-default btn-square">Grun</button>
</div>
<div class="col-xs-6 col-md-12">
<button type="button" style="background-color:#FFB24A" class="btn btn-block btn-default btn-square">Orange</button>
<button type="button" style="background-color:#FFFD5E" class="btn btn-block btn-default btn-square">Gelb</button>
</div>
</div>
</div>
</div>
</div>
As a side-note, given the order of the buttons is not really important, the sane method here would have been to put all the buttons in one column and arrange them using either flexbox:
.\31\30-cols .col-xs-12 {
display: flex;
flex-wrap: wrap;
}
.\31\30-cols .col-xs-12 .btn {
flex: 1 0 calc(50% - 20px);
margin: 5px;
}
#media (min-width: 992px) {
.\31\30-cols .col-xs-12 .btn {
flex-basis: calc(20% - 10px);
}
}
.\31\30-cols .col-xs-12 {
display: flex;
flex-wrap: wrap;
}
.\31\30-cols .col-xs-12 .btn {
flex: 1 0 calc(50% - 20px);
margin: 5px;
}
#media (min-width: 992px) {
.\31\30-cols .col-xs-12 .btn {
flex-basis: calc(20% - 10px);
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="container">
<div class="row 10-cols">
<div class="col-xs-12">
<button type="button" style="background-color:white" class="btn btn-block btn-default btn-square">white</button>
<button type="button" style="background-color:#F7F6E4" class="btn btn-block btn-default btn-square">Beige</button>
<button type="button" style="background-color:#3BA6F8" class="btn btn-block btn-default btn-square">Blau</button>
<button type="button" style="background-color:#F36660" class="btn btn-block btn-default btn-square">Rot</button>
<button type="button" style="background-color:#FDFCEA" class="btn btn-block btn-default btn-square">Creme</button>
<button type="button" style="background-color:#DBDBDB" class="btn btn-block btn-default btn-square">Graue</button>
<button type="button" style="background-color:#E6C08E" class="btn btn-block btn-default btn-square">Eiche</button>
<button type="button" style="background-color:#358B9F" class="btn btn-block btn-default btn-square">Petrol</button>
<button type="button" style="background-color:#FF7ECD" class="btn btn-block btn-default btn-square">Rosa</button>
<button type="button" style="background-color:#C9C9C9" class="btn btn-block btn-default btn-square">Silber</button>
<button type="button" style="background-color:#505558;color:white;" class="btn btn-block btn-default btn-square">Anthrazit</button>
<button type="button" style="background-color:C39881" class="btn btn-block btn-default btn-square">Taupe</button>
<button type="button" style="background-color:#569A9E" class="btn btn-block btn-default btn-square">Trukis</button>
<button type="button" style="background-color:#A03A97" class="btn btn-block btn-default btn-square">Lila</button>
<button type="button" style="background-color:#FFDB53" class="btn btn-block btn-default btn-square">Gold</button>
<button type="button" style="background-color:#2E2E2E;color:white;" class="btn btn-block btn-default btn-square">Schwarz</button>
<button type="button" style="background-color:#A16340" class="btn btn-block btn-default btn-square">Braun</button>
<button type="button" style="background-color:#C9DDA8" class="btn btn-block btn-default btn-square">Grun</button>
<button type="button" style="background-color:#FFB24A" class="btn btn-block btn-default btn-square">Orange</button>
<button type="button" style="background-color:#FFFD5E" class="btn btn-block btn-default btn-square">Gelb</button>
</div>
</div>
</div>
or CSS columns:
.\31\30-cols .col-xs-12 {
columns: 2;
column-gap: 10px;
}
#media (min-width: 992px) {
.\31\30-cols .col-xs-12 {
columns: 5;
}
}
.\31\30-cols .col-xs-12 {
columns: 2;
column-gap: 10px;
}
#media (min-width: 992px) {
.\31\30-cols .col-xs-12 {
columns: 5;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="container">
<div class="row 10-cols">
<div class="col-xs-12">
<button type="button" style="background-color:white" class="btn btn-block btn-default btn-square">white</button>
<button type="button" style="background-color:#F7F6E4" class="btn btn-block btn-default btn-square">Beige</button>
<button type="button" style="background-color:#3BA6F8" class="btn btn-block btn-default btn-square">Blau</button>
<button type="button" style="background-color:#F36660" class="btn btn-block btn-default btn-square">Rot</button>
<button type="button" style="background-color:#FDFCEA" class="btn btn-block btn-default btn-square">Creme</button>
<button type="button" style="background-color:#DBDBDB" class="btn btn-block btn-default btn-square">Graue</button>
<button type="button" style="background-color:#E6C08E" class="btn btn-block btn-default btn-square">Eiche</button>
<button type="button" style="background-color:#358B9F" class="btn btn-block btn-default btn-square">Petrol</button>
<button type="button" style="background-color:#FF7ECD" class="btn btn-block btn-default btn-square">Rosa</button>
<button type="button" style="background-color:#C9C9C9" class="btn btn-block btn-default btn-square">Silber</button>
<button type="button" style="background-color:#505558;color:white;" class="btn btn-block btn-default btn-square">Anthrazit</button>
<button type="button" style="background-color:C39881" class="btn btn-block btn-default btn-square">Taupe</button>
<button type="button" style="background-color:#569A9E" class="btn btn-block btn-default btn-square">Trukis</button>
<button type="button" style="background-color:#A03A97" class="btn btn-block btn-default btn-square">Lila</button>
<button type="button" style="background-color:#FFDB53" class="btn btn-block btn-default btn-square">Gold</button>
<button type="button" style="background-color:#2E2E2E;color:white;" class="btn btn-block btn-default btn-square">Schwarz</button>
<button type="button" style="background-color:#A16340" class="btn btn-block btn-default btn-square">Braun</button>
<button type="button" style="background-color:#C9DDA8" class="btn btn-block btn-default btn-square">Grun</button>
<button type="button" style="background-color:#FFB24A" class="btn btn-block btn-default btn-square">Orange</button>
<button type="button" style="background-color:#FFFD5E" class="btn btn-block btn-default btn-square">Gelb</button>
</div>
</div>
</div>

Bootstrap button group always align horizontally

Bootstrap button group make them always in one line, always align horizontally.
When I resize window button comes down vertically.
I am looking for a solution where button comes always in one line no matter what.
I have applied style="white-space:nowrap;" on parent div but it doesn't work.
If possible try to use only bootstrap's inbuilt css classes.
Please answer by keeping current HTML structure as it is. Because that's how it is implemented in mine project.
This is simplest implementation of bootstrap button group. See PLUNKER
CODE
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="well form-horizontal">
<div class="form-group" style="white-space:nowrap;">
<div>
<div class="btn-group">
<button type="button" class="btn btn-primary">
11111
</button>
<button type="button" class="btn btn-success">
22222
</button>
<button type="button" class="btn btn-primary">
33333
</button>
<button type="button" class="btn btn-success">
44444
</button>
<button type="button" class="btn btn-primary">
55555
</button>
<button type="button" class="btn btn-success">
22222
</button>
<button type="button" class="btn btn-primary">
33333
</button>
<button type="button" class="btn btn-success">
44444
</button>
<button type="button" class="btn btn-primary">
55555
</button>
<button type="button" class="btn btn-success">
44444
</button>
<button type="button" class="btn btn-primary">
55555
</button>
</div>
</div>
</div>
</div>
You need to override the float: left; as well as add white-space: nowrap; to the parent. So in your css:
.btn-group {
white-space: nowrap;
}
.btn.btn-primary,
.btn.btn-success {
float: none;
}
plunker: https://plnkr.co/edit/lRWyHeeN78d2sSNaXGSZ?p=preview
Although, I would recommend adding a specific class to the btn-group/btn-primary/btn-success because overriding bootstraps styling instead of just adding a custom class is a bad practice.
For example:
HTML:
<div class="btn-group custom-class">
<button type="button" class="btn btn-primary custom-class">
<button type="button" class="btn btn-success custom-class">
CSS:
.btn-group.custom-class{...}
.btn.btn-primary.custom-class,
.btn.btn-success.custom-class {...}
https://plnkr.co/edit/nAZD6Hssgnep37fXU9vb?p=preview
Try display:inline-flex on parent instead on display:inline-block on btn-group
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="well form-horizontal" style="">
<div class="form-group" style="white-space:nowrap;">
<div>
<div class="btn-group" style="display:inline-flex;">
<button type="button" class="btn btn-primary">
11111
</button>
<button type="button" class="btn btn-success">
22222
</button>
<button type="button" class="btn btn-primary">
33333
</button>
<button type="button" class="btn btn-success">
44444
</button>
<button type="button" class="btn btn-primary">
55555
</button>
<button type="button" class="btn btn-success">
22222
</button>
<button type="button" class="btn btn-primary">
33333
</button>
<button type="button" class="btn btn-success">
44444
</button>
<button type="button" class="btn btn-primary">
55555
</button>
<button type="button" class="btn btn-success">
44444
</button>
<button type="button" class="btn btn-primary">
55555
</button>
</div>
</div>
</div>
</div>

How can i display all buttons to right in bootstrap panel heading?

I want to display buttons to the right in bootstrap panel-heading i tried to add pull-right class on all buttons but its breaking some css rules on panel-body, How can i display all buttons on right side in bootstrap panel-heading ?
main.html
<div class="col-md-11">
<div ng-show="showMessage">
<p class="recordMessage">File is being recorded to the server ,once you stop recording it will prompt for cancel or download. </p>
</div>
<div class="panel panel-default">
<div class="panel-heading">DIT LOGS
<div class="pull-right" style="padding-right: 300px">
<button type="button" class="btn btn-danger btn-rad btn-lg"><span class="glyphicon glyphicon-record"></span></button>
<button type="button" class="btn btn-primary btn-rad btn-lg"><span class="glyphicon glyphicon-stop"></span></button>
<button type="button" class="btn btn-success btn-rad btn-lg"><span class="glyphicon glyphicon-search"></span></button>
<button type="button" class="btn btn-info btn-rad btn-lg"><span class="glyphicon glyphicon-folder-open"></span></button>
</div>
</div>
<div class="panel-body display-logs" scroll-bottom="event">
<ul style="list-style: none;">
<li ng-repeat="message in event track by $index" ng-class="{lastItem: $last}"><span><strong>Log:</strong></span><span>{{message}}</span></li>
</ul>
</div>
</div>
</div>
try putting them in an other div
<div class="panel-heading">DIT LOGS
<div class="pull-right">
<button type="button" class="btn btn-danger btn-rad btn-xs"><span class="glyphicon glyphicon-record"></span></button>
<button type="button" class="btn btn-primary btn-rad btn-xs"><span class="glyphicon glyphicon-stop"></span></button>
<button type="button" class="btn btn-success btn-rad btn-xs"><span class="glyphicon glyphicon-search"></span></button>
<button type="button" class="btn btn-info btn-rad btn-xs"><span class="glyphicon glyphicon-folder-open"></span></button>
</div>
</div>

Btn-group not stretching width of table

I have a table with a table header and a table row. The header is a btn-group, with 12 buttons to resemble months of a calendar, the row is of 31 columns. I want the btn-group to distribute evenly & stretch the full width of the table row. I can add style="width:100px;" to each button, but that's not responsive, and I don't necessarily know the width of the full table.
Can anyone see what I need to add to my code?
<thead>
<tr>
<th colspan="31">
<div class="btn-toolbar" role="toolbar">
<div class="btn-group">
<button type="button" class="btn btn-default">Jan</button>
<button type="button" class="btn btn-default">Feb</button>
<button type="button" class="btn btn-default">Mar</button>
<button type="button" class="btn btn-default active">Apr</button>
<button type="button" class="btn btn-default">May</button>
<button type="button" class="btn btn-default">Jun</button>
<button type="button" class="btn btn-default">Jul</button>
<button type="button" class="btn btn-default">Aug</button>
<button type="button" class="btn btn-default">Sep</button>
<button type="button" class="btn btn-default">Oct</button>
<button type="button" class="btn btn-default">Nov</button>
<button type="button" class="btn btn-default">Dec</button>
</div>
</div>
</th>
</tr>
</thead>
Here is the css tag I changed from the Bootstrap 3 defaults:
.btn-group {
width:100%;
}
.btn-toolbar {
width:100%;
}
If I use btn-group-justified, it looks like this:
Add the following class to the parent container: .btn-group-justified
<thead>
<tr>
<th colspan="31">
<div class="btn-toolbar" role="toolbar">
<div class="btn-group btn-group-justified">
<button type="button" class="btn btn-default">Jan</button>
<button type="button" class="btn btn-default">Feb</button>
<button type="button" class="btn btn-default">Mar</button>
<button type="button" class="btn btn-default active">Apr</button>
<button type="button" class="btn btn-default">May</button>
<button type="button" class="btn btn-default">Jun</button>
<button type="button" class="btn btn-default">Jul</button>
<button type="button" class="btn btn-default">Aug</button>
<button type="button" class="btn btn-default">Sep</button>
<button type="button" class="btn btn-default">Oct</button>
<button type="button" class="btn btn-default">Nov</button>
<button type="button" class="btn btn-default">Dec</button>
</div>
</div>
</th>
</tr>
and for even more reference, read the following part of the documentation:
http://getbootstrap.com/components/#btn-groups-justified