My Angular projects loads all the other components, but i tried to add this scientific calculator i found (link) and the CSS does not load in a SCSS file even if it should not give this type of problems!
I already tried looking better at the source code to see if i missed something but found nothing!
HTML
<div class="p-1 form-group">
<form method="POST" class="alert alert-secondary">
<div class="w-100">
<div class="row pb-1">
<div class="col text-right">
<span class="badge badge-info" *ngIf="statusMemory()">Mem: {{valueMemory()}}</span>
<span class="badge badge-success" *ngIf="getOperand()!='';" [innerHTML]="getOperand()"></span>
<span class="badge badge-warning" *ngIf="getRadians(); else badgeGrads">Rad</span>
<ng-template #badgeGrads><span class="badge badge-info">Grad</span></ng-template>
</div>
</div>
<div class="row">
<div class="col"><input type="text" placeholder="0" #inputField value="{{getFormula()}}" class="form-control text-right"></div>
</div>
<div class="row pt-2">
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="addBracket('(');">(</button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="addBracket(')');">)</button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="clearMemory();">mc</button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="sumToMemory();">m+</button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="deductToMemory();">m-</button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="readMemory();">mr</button></div>
<div class="col"><button class="form-control btn btn-sm btn-danger" (click)="clear();">C</button></div>
<div class="col"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('invert',-1);">±</button></div>
<div class="col"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('percent',-1);">%</button></div>
<div class="col"><button class="form-control btn btn-sm btn-xl btn-info" (click)="setOperation('/');">÷</button></div>
</div>
<div class="row pt-2">
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else fs"><button class="form-control btn btn-sm btn-secondary" (click)="secondScreen();">2<sup>nd</sup></button></div>
<ng-template #fs><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="secondScreen();">1<sup>nd</sup></button></div></ng-template>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('pow',2);">x<sup>2</sup></button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('pow',3);">x<sup>3</sup></button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="setOperation('pow');">x<sup>y</sup></button></div>
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else yx"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('pow_base','e');">e<sup>x</sup></button></div>
<ng-template #yx><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="setOperation('yx');">y<sup>x</sup></button></div></ng-template>
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else x2"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('pow_base',10);">10<sup>x</sup></button></div>
<ng-template #x2><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="singleton('pow_base',2);">2<sup>x</sup></button></div></ng-template>
<div class="col"><button class="form-control btn btn-sm btn-success" (click)="addSymbol('7');">7</button></div>
<div class="col"><button class="form-control btn btn-sm btn-success" (click)="addSymbol('8');">8</button></div>
<div class="col"><button class="form-control btn btn-sm btn-success" (click)="addSymbol('9');">9</button></div>
<div class="col"><button class="form-control btn btn-sm btn-xl btn-info" (click)="setOperation('*');">×</button></div>
</div>
<div class="row pt-2">
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('div',1);"><sup>1</sup>/<sub>x</sub></button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('sqrt',2);"><sup>2</sup>√x</button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('sqrt3',1/3);"><sup>3</sup>√x</button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="setOperation('sqrt');"><sup>y</sup>√x</button></div>
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else log"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('ln',2.7);">ln</button></div>
<ng-template #log><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="setOperation('log');">log<sub>y</sub></button></div></ng-template>
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else log2"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('lg',10);">lg</button></div>
<ng-template #log2><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="singleton('lg',2);">log<sub>2</sub></button></div></ng-template>
<div class="col"><button class="form-control btn btn-sm btn-success" (click)="addSymbol('4');">4</button></div>
<div class="col"><button class="form-control btn btn-sm btn-success" (click)="addSymbol('5');">5</button></div>
<div class="col"><button class="form-control btn btn-sm btn-success" (click)="addSymbol('6');">6</button></div>
<div class="col"><button class="form-control btn btn-sm btn-xl btn-info" (click)="setOperation('-');">−</button></div>
</div>
<div class="row pt-2">
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('factorial',1);">x!</button></div>
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else asin"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('sin',1);">sin</button></div>
<ng-template #asin><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="singleton('asin',1);">sin<sup>-1</sup></button></div></ng-template>
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else acos"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('cos',1);">cos</button></div>
<ng-template #acos><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="singleton('acos',1);">cos<sup>-1</sup></button></div></ng-template>
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else atan"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('tan',1);">tan</button></div>
<ng-template #atan><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="singleton('atan',1);">tan<sup>-1</sup></button></div></ng-template>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="addSymbol('2.718281828459045',true);">e</button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('ee',1);" title="Exponencial view of number">EE</button></div>
<div class="col"><button class="form-control btn btn-sm btn-success" (click)="addSymbol('1');">1</button></div>
<div class="col"><button class="form-control btn btn-sm btn-success" (click)="addSymbol('2');">2</button></div>
<div class="col"><button class="form-control btn btn-sm btn-success" (click)="addSymbol('3');">3</button></div>
<div class="col"><button class="form-control btn btn-sm btn-xl btn-info" (click)="setOperation('+');">+</button></div>
</div>
<div class="row pt-2">
<div class="col d-none d-lt-flex" *ngIf="getRadians(); else Grads"><button class="form-control btn btn-sm btn-warning" (click)="setRadians();">Rad</button></div>
<ng-template #Grads><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="setRadians();">Grad</button></div></ng-template>
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else asinh"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('sinh',1);">sin<sup>h</sup></button></div>
<ng-template #asinh><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="singleton('asinh',1);">sinh<sup>-1</sup></button></div></ng-template>
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else acosh"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('cosh',1);">cos<sup>h</sup></button></div>
<ng-template #acosh><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="singleton('acosh',1);">cosh<sup>-1</sup></button></div></ng-template>
<div class="col d-none d-lt-flex" *ngIf="!getScreen(); else atanh"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('tanh',1);">tan<sup>h</sup></button></div>
<ng-template #atanh><div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-info" (click)="singleton('atanh',1);">tanh<sup>-1</sup></button></div></ng-template>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="addSymbol('3.141592653589793',true);">ℼ</button></div>
<div class="col d-none d-lt-flex"><button class="form-control btn btn-sm btn-secondary" (click)="singleton('rand',1);">Rnd</button></div>
<div class="col-2 mycol-2"><button class="form-control btn btn-sm btn-success" (click)="addSymbol('0');">0</button></div>
<div class="col"><button class="form-control btn btn-sm btn-success"(click)="addSymbol('.');">,</button></div>
<div class="col"><button class="form-control btn btn-sm btn-primary" (click)="calculate();">=</button></div>
</div>
</div>
</form>
</div>
CSS
.mycol-2 {
flex: 0 0 50%;
max-width: 50%;
}
.col {
padding-left: 5px;
padding-right: 5px;
}
.col-2 {
padding-left: 5px;
padding-right: 5px;
}
.btn-xl {
font-size: 1.5rem;
line-height: 0.9;
}
.btn-sm {
border-radius: 0;
}
#media (min-width: 420px) {
.d-lt-none {
display: none !important;
}
.d-lt-inline {
display: inline !important;
}
.d-lt-inline-block {
display: inline-block !important;
}
.d-lt-block {
display: block !important;
}
.d-lt-table {
display: table !important;
}
.d-lt-table-row {
display: table-row !important;
}
.d-lt-table-cell {
display: table-cell !important;
}
.d-lt-flex {
display: -ms-flexbox !important;
display: flex !important;
}
.d-lt-inline-flex {
display: -ms-inline-flexbox !important;
display: inline-flex !important;
}
.mycol-2 {
flex: 0 0 20%;
max-width: 20%;
}
}
I tried searching for some missing parts but found nothing useful
Related
As title, I want to create a input-group for number increase/decrease.
This is my code:
<div class="input-group input-group-sm">
<input type="text" class="form-control" placeholder="0.9">
<div class="btn-group-vertical">
<button class="btn btn-primary btn-sm" type="button">+</button>
<button class="btn btn-primary btn-sm" type="button">-</button>
</div>
</div>
Result
Expected result
You need to add py-0 for remove top & bottom padding and lh-1 for decrease line height of button. Your code should be as below:
<div class="input-group input-group-sm">
<input type="text" class="form-control" placeholder="0.9">
<div class="btn-group-vertical">
<button class="btn btn-primary btn-sm py-0 lh-1" type="button">+</button>
<button class="btn btn-primary btn-sm py-0 lh-1" type="button">-</button>
</div>
</div>
add p-0 in button so the code will like this :
<div class="input-group input-group-sm">
<input type="text" class="form-control" placeholder="0.9">
<div class="btn-group-vertical">
<button class="btn btn-primary btn-sm p-0" type="button">+</button>
<button class="btn btn-primary btn-sm p-0" type="button">-</button>
</div>
</div>
I have a group of multiple buttons that span multiple lines, but when a button no longer fits on a line it just goes on the next line and the remaining space is left blank. I'd instead like to have equal spacing between the buttons that did make it onto that line so that the line appears full.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<div class="mx-auto" style="width: 90%;" >
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test 2'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test 3'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test Much Longer String That Makes This Multiple Lines 4'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test 5'>
</div>
I would like to make it so that the buttons end up spaced out such that there are multiple buttons on a line, but that each line is full. There are a number of different examples that create columns explicitly, but they all seem to assume that you know how many buttons/columns you'll have vs. having buttons of different sizes and auto-adjusting the spacing between them. I'd like to be able to auto-adjust the spacing between so that they'll fill the full line, e.g. space out 1 2, 3 so 1 starts at the far left and 3 ends at the far right. How can I do that?
I see you're using Bootstrap, check out Flex.
You can use something like: d-flex flex-wrap justify-content-between on the perent element.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<div class="w-90 mx-auto d-flex flex-wrap justify-content-between">
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test 2'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test 3'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test Much Longer String That Makes This Multiple Lines 4'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test 5'>
</div>
If you replace the <div class="mx-auto"> wit the classes <div class="d-flex justify-content-between"> the links will be distributed in equal space between them along the parent div.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<div class="d-flex justify-content-between" style="width: 90%">
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test 2'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test 3'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test Much Longer String That Makes This Multiple Lines 4'>
<input type='submit' name="my_button" class="btn btn-outline-primary me-3 mb-4 btn-lg btn-block" value='Test 5'>
</div>
In addition, if you want to use mx-auto, you must do it on the element you want to have the auto margin, in your case each <input>. And remember that the item must be display: block or display: inline-block
An alternative method is to use a card group for an arbitrary number of buttons both equally spaced and equally sized, all on one line responsively, above the sm breakpoint.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<div class="card-group mb-4">
<div class="card mx-2">
<input type='submit' name="my_button" class="btn btn-outline-primary btn-lg h-100 text-wrap" value='Test'>
</div>
<div class="card mx-2">
<input type='submit' name="my_button" class="btn btn-outline-primary btn-lg h-100 text-wrap" value='Test 2'>
</div>
<div class="card mx-2">
<input type='submit' name="my_button" class="btn btn-outline-primary btn-lg h-100 text-wrap" value='Test 3'>
</div>
<div class="card mx-2">
<input type='submit' name="my_button" class="btn btn-outline-primary btn-lg h-100 text-wrap" value='Test Much Longer String That Makes This Multiple Lines 4'>
</div>
<div class="card mx-2">
<input type='submit' name="my_button" class="btn btn-outline-primary btn-lg h-100 text-wrap" value='Test 5'>
</div>
</div>
<hr>
<div class="card-group mb-4">
<div class="card mx-2">
<input type='submit' name="my_button" class="btn btn-outline-primary btn-lg h-100 text-wrap" value='another Test'>
</div>
<div class="card mx-2">
<input type='submit' name="my_button" class="btn btn-outline-primary btn-lg h-100 text-wrap" value='another Test 2'>
</div>
<div class="card mx-2">
<input type='submit' name="my_button" class="btn btn-outline-primary btn-lg h-100 text-wrap" value='Test little Longer String'>
</div>
</div>
I am using the following code to generate the buttons below, but 1) the button couldn't spread across the, after using btn-block suggested. And also the button didn't center-aligned, as justify-content-center suggested. I pasted my code below:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css">
<div class="container">
<div class="row">
<div class="col pl-1">
<div class="form-row no-gutters h-100">
<div class="form-group col card form-header text-center">
<div class="card-header form-label">
<label for="action">Action <i class="fas fa-plus"></i></label>
</div>
<div class="card-body h-100 d-flex flex-column">
<div class="p-2">
<button type="button" class="btn btn-sm btn-outline-secondary btn-block" id="refresh"><i
class="fas fa-sync"></i></button>
</div>
<div class="p-2">
<div class="row">
<div class="col-6">
<button type="button" class="btn btn-sm btn-outline-secondary btn-block" id="selectAll"><i class="fas fa-check"></i></button>
</div>
<div class="col-6">
<button type="button" class="btn btn-sm btn-outline-secondary btn-block" id="deselectAll" disabled><i class="fas fa-times"></i></button>
</div>
</div>
</div>
<div class="p-2">
<div class="row">
<div class="col-6">
<button type="button" class="btn btn-sm btn-success btn-block" id="call" disabled>C</button>
</div>
<div class="col-6">
<button type="button" class="btn btn-sm btn-danger btn-block" id="put" disabled>P</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
And the screenshow below:
I would like to 1) Vertical Align the button 2) Decrease the spacing between the buttons 3) Make sure the whole card align with the box on the left (I used h-100 to ensure it fills the whole height). Similar to the pics below:
Thanks in advance
you simply edit one class of bootstrap .col-1 to .col-4 and you get the like image
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<div class="col-4 pl-1">
<div class="form-row no-gutters h-100">
<div class="form-group col card form-header text-center">
<div class="card-header form-label">
<label for="action">Action <i class="fas fa-plus"></i></label>
</div>
<div class="card-body h-100 d-flex flex-column">
<div class="p-2">
<button type="button" class="btn btn-sm btn-outline-secondary btn-block" id="refresh"><i
class="fas fa-sync"></i></button>
</div>
<div class="p-2">
<div class="row">
<div class="col-6">
<button type="button" class="btn btn-sm btn-outline-secondary btn-block" id="selectAll"><i class="fas fa-check"></i></button>
</div>
<div class="col-6">
<button type="button" class="btn btn-sm btn-outline-secondary btn-block" id="deselectAll" disabled><i class="fas fa-times"></i></button>
</div>
</div>
</div>
<div class="p-2">
<div class="row">
<div class="col-6">
<button type="button" class="btn btn-sm btn-success btn-block" id="call" disabled>C</button>
</div>
<div class="col-6">
<button type="button" class="btn btn-sm btn-danger btn-block" id="put" disabled>P</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I do have this HTML, but I am not able to do this:
The width of the first column Links available should be same like the length of Links available, and the text shouldn't split this two words. It should be one line Links available
On the column Links available only header is important, the cells below will not be used, so it could be hidden
The buttons should have a little bit space between next button, and it should be like inline...
What I want to, in visual:
My HTML:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"/>
<table class="table">
<thead>
<tr>
<th class="col-xl">Links available:</th>
<th class="col-xl-auto">Category 1</th>
<th class="col-xl-auto">Category 2</th>
<th class="col-xl-auto">Category 3</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col-xl"></td>
<td class="col-xl-3">
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
</td>
<td class="col-xl-3">
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
</td>
<td class="col-xl-3">
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
</td>
</tr>
<tr>
<td class="col-xl"></td>
<td class="col-xl-3">
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
</td>
<td class="col-xl-3">
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
</td>
<td class="col-xl-3">
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
</td>
</tr>
<tr>
<td class="col-xl"></td>
<td class="col-xl-3">
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
</td>
<td class="col-xl-3">
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
</td>
<td class="col-xl-3">
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm">Small button</button>
</td>
</tr>
</tbody>
</table>
if you would like to test my code, please use: codeply - Bootstrap snippets
If you want to remove responsiveness column
change
col-md-3
to
col-3
Code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet">
<table class="table">
<thead>
<tr class="">
<th class="">Links available:</th>
<th class="">Category 1</th>
<th class="">Category 2</th>
<th class="">Category 3</th>
</tr>
</thead>
<tbody>
<tr>
<td class=""></td>
<td class="">
<div class="row">
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
</td>
<td class="">
<div class="row">
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
</td>
<td class="">
<div class="row">
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
</td>
</tr>
<tr>
<td class=""></td>
<td class="">
<div class="row">
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
</td>
<td class="">
<div class="row">
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
</td>
<td class="">
<div class="row">
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
</td>
</tr>
<tr>
<td class=""></td>
<td class="">
<div class="row">
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
</td>
<td class="">
<div class="row">
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
</td>
<td class="">
<div class="row">
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
</td>
</tr>
</tbody>
</table>
Second code using DIV
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet">
<div class="container-fluid p-0">
<div class="row m-0">
<div class="col-3 p-0">
<p class="font-weight-bold">Links available:</p>
</div>
<div class="col-3 p-0">
<p class="font-weight-bold">Category 1</p>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
<div class="col-3 p-0">
<p class="font-weight-bold">Category 2</p>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
<div class="col-3 p-0">
<p class="font-weight-bold">Category 3</p>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
<button type="button" class="btn btn-outline-primary btn-sm col-md-3 mr-1">Small button</button>
</div>
</div>
</div>
I think you are searching for a nested Grid Layout. I recommend to read about this, so you can see examples of how to work with the Bootstrap Grid System. Even more, on XS (EXTRA SMALL) screens sizes I recommend to stack the categories vertically because of the little width you have available. You can check this all on next example:
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 text-center">
<p class="my-1">Links available:</p>
</div>
<div class="col-sm-3 text-center bg-warning">
<div class="row">
<div class="col-12 my-1">Category 1:</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-primary btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-danger btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-success btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-primary btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-danger btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-success btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-primary btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-danger btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-success btn-block">B</button>
</div>
</div>
</div>
<div class="col-sm-3 text-center">
<div class="row">
<div class="col-12 my-1">Category 2:</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-primary btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-danger btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-success btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-primary btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-danger btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-success btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-primary btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-danger btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-success btn-block">B</button>
</div>
</div>
</div>
<div class="col-sm-3 text-center bg-warning">
<div class="row">
<div class="col-12 my-1">Category 3:</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-primary btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-danger btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-success btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-primary btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-danger btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-success btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-primary btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-danger btn-block">B</button>
</div>
<div class="col-4 my-1">
<button type="button" class="btn btn-success btn-block">B</button>
</div>
</div>
</div>
</div>
</div>
I copied from bootstrap's site. But doesnt work me i cant figure out. Can you help me why. I am trying to fix it for hours. I want to make like menu button there also dropdowns not working properly. I copied bootstrap files to my project folder and use code to head of html file to implent them. Any help would be appreciated.
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<div class= "container" >
<div class="pos-f-t" style="width: 202px">
<div class="collapse" id="navbarToggleExternalContent">
<div class="bg-dark p-4" style="width: 202px">
<h5 class="text-white h4">Collapsed content</h5>
<span class="text-muted">Toggleable via the navbar brand.</span>
</div>
</div>
<nav class="navbar navbar-dark bg-dark">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
</div>
<div class="border bg-danger border-dark" style="height:2cm; width : 5.35cm; margin-bottom: -2px;font-weight: bold ">
<div class = "row" style="padding-left: 0.4cm" >
<p style="font-size: 20px">{{y}}</p>
<p style="font-size: 10px">{{z}}</p>
</div>
<div class ="row" style="padding-left: 0.4cm">
<p style="font-size: 20px; ">{{x}}</p>
<p style="font-size: 20px; ">{{contr}}</p>
<p style="font-size: 20px; margin-top: 0.7cm;">{{sum}}</p>
</div>
</div>
<div class ="border bg-black border-danger" style="width: 5.3cm;">
<div class ="row" style="padding-left: 0.4cm">
<div class="col-xs">
<div class="btn-group" aria-label="Justified button group">
<input type ="button" class="btn btn-dark btn-lg border border-danger rounded-0" (click)="getPast()" value="M" >
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0" (click)="makeDivided()" value="⅟x">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0" (click)="root()" value="√">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0" (click)="square()" value="a²">
</div>
</div>
</div>
<div class="row" style="padding-left: 0.4cm">
<div class="col-xs">
<div class="btn-group">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="clear()" value="CE">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="clearAll()" value="C">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="delete()" value="←">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="division()" value="/">
</div>
</div>
</div>
<div class ="row" style="padding-left: 0.4cm">
<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group">
<div class = "col-xs">
<div class="btn-group">
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('1')"> 1 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('2')"> 2 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('3')"> 3 </button>
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="add()" value="+" >
</div>
</div>
</div>
</div>
<div class = "row" style="padding-left: 0.4cm">
<div class = "btn-group btn-group-justified" role="group">
<div class = "col-xs">
<div class="btn-group">
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('4')"> 4 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('5')"> 5 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('6')"> 6 </button>
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="substract()" value="-">
</div>
</div>
</div>
</div>
<div class = "row" style="padding-left: 0.4cm">
<div class="btn-group" role="group">
<div class = "col-xs">
<div class="btn-group">
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('7')"> 7 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0 " (click)="getValue('8')"> 8 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('9')"> 9 </button>
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="multiple()" value="*">
</div>
</div>
</div>
</div>
<div class = "row" style="padding-left: 0.4cm">
<div class="col-xs">
<div class="btn-group">
<input type="button" class="btn btn-dark border border-danger rounded-0 border-top-0" (click)="changeMark()" value="∓">
<button class="btn btn-danger border border-danger rounded-0 border-top-0" (click)="getValue('0')">0</button>
<button class="btn btn-dark border border-danger rounded-0 border-top-0" (click)="addKama()" >,</button>
<input class="btn btn-dark border border-danger rounded-0 border-top-0" type="button" (click)="total()" value="=">
</div>
</div>
</div>
</div>
</div>
You just need to include jquery cdn to get it working
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script
src="https://code.jquery.com/jquery-3.3.1.slim.js"
integrity="sha256-fNXJFIlca05BIO2Y5zh1xrShK3ME+/lYZ0j+ChxX2DA="
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<div class= "container" >
<div class="pos-f-t" style="width: 202px">
<div class="collapse" id="navbarToggleExternalContent">
<div class="bg-dark p-4" style="width: 202px">
<h5 class="text-white h4">Collapsed content</h5>
<span class="text-muted">Toggleable via the navbar brand.</span>
</div>
</div>
<nav class="navbar navbar-dark bg-dark">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
</div>
<div class="border bg-danger border-dark" style="height:2cm; width : 5.35cm; margin-bottom: -2px;font-weight: bold ">
<div class = "row" style="padding-left: 0.4cm" >
<p style="font-size: 20px">{{y}}</p>
<p style="font-size: 10px">{{z}}</p>
</div>
<div class ="row" style="padding-left: 0.4cm">
<p style="font-size: 20px; ">{{x}}</p>
<p style="font-size: 20px; ">{{contr}}</p>
<p style="font-size: 20px; margin-top: 0.7cm;">{{sum}}</p>
</div>
</div>
<div class ="border bg-black border-danger" style="width: 5.3cm;">
<div class ="row" style="padding-left: 0.4cm">
<div class="col-xs">
<div class="btn-group" aria-label="Justified button group">
<input type ="button" class="btn btn-dark btn-lg border border-danger rounded-0" (click)="getPast()" value="M" >
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0" (click)="makeDivided()" value="⅟x">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0" (click)="root()" value="√">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0" (click)="square()" value="a²">
</div>
</div>
</div>
<div class="row" style="padding-left: 0.4cm">
<div class="col-xs">
<div class="btn-group">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="clear()" value="CE">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="clearAll()" value="C">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="delete()" value="←">
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="division()" value="/">
</div>
</div>
</div>
<div class ="row" style="padding-left: 0.4cm">
<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group">
<div class = "col-xs">
<div class="btn-group">
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('1')"> 1 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('2')"> 2 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('3')"> 3 </button>
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="add()" value="+" >
</div>
</div>
</div>
</div>
<div class = "row" style="padding-left: 0.4cm">
<div class = "btn-group btn-group-justified" role="group">
<div class = "col-xs">
<div class="btn-group">
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('4')"> 4 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('5')"> 5 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('6')"> 6 </button>
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="substract()" value="-">
</div>
</div>
</div>
</div>
<div class = "row" style="padding-left: 0.4cm">
<div class="btn-group" role="group">
<div class = "col-xs">
<div class="btn-group">
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('7')"> 7 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0 " (click)="getValue('8')"> 8 </button>
<button type="button" class="btn btn-danger btn-lg border border-dark rounded-0 border-top-0" (click)="getValue('9')"> 9 </button>
<input type="button" class="btn btn-dark btn-lg border border-danger rounded-0 border-top-0" (click)="multiple()" value="*">
</div>
</div>
</div>
</div>
<div class = "row" style="padding-left: 0.4cm">
<div class="col-xs">
<div class="btn-group">
<input type="button" class="btn btn-dark border border-danger rounded-0 border-top-0" (click)="changeMark()" value="∓">
<button class="btn btn-danger border border-danger rounded-0 border-top-0" (click)="getValue('0')">0</button>
<button class="btn btn-dark border border-danger rounded-0 border-top-0" (click)="addKama()" >,</button>
<input class="btn btn-dark border border-danger rounded-0 border-top-0" type="button" (click)="total()" value="=">
</div>
</div>
</div>
</div>
</div>