Adjust Buttons in Internet Explorer 11 (CSS, HTML, Bootstrap) - html

I have the following Code written in HTML and Angular:
<form [formGroup]="form">
<div class="modal-header">
<span class="modal-title">...</span>
<button type="button" class="close" aria-label="Close" (click)="dismiss()">
<fa-icon class="option-svg" icon="times"></fa-icon>
</button>
</div>
<div class="modal-body">
<div class="row form-group mt-3">
<div class="col-12">
<div>
<p>...</p>
</div>
<div>
<div class="col-6 form-group">
<select class="form-control" formControlName="selectedReason"
id="selectedReason" name="selectedReason">
<option *ngFor="let option of reasons" [ngValue]="option.text">{{option.text}}</option>
</select>
</div>
</div>
<div *ngIf="isOther()">
<div class="col-sm-6 col-lg-12">
<input class="form-control" id="other" type="text" aria-describedby="other" formControlName="other">
</div>
</div>
</div>
</div>
<div class="row form-group">
<div class="col-12">
<p class="warning-message">Wollen Sie das Image wirklich produktiv schalten?</p>
</div>
</div>
</div>
<div class="modal-footer">
<div class="row form-group">
<div class="col-6">
<button type="button" class="btn btn-secondary" (click)="dismiss()">Cancel</button>
<button type="button" class="btn btn-primary" (click)="close()" id="swapImage">Swap</button>
</div>
</div>
</div>
</form>
While testing it on Google Chrome, it works just fine and the buttons are as intended next to each other. On Internet Explorer though, the Swap button is underneath the other button. How can I fix this? :/

It works as expected on on IE/EDGE v11 and chrome.
Can you confirm the IE version used.
I used IE 11 to test your code all looks fine..

Is there any other CSS style? Which version of Bootstrap and angular version are you using? I have test your code on my side using Bootstrap 4 version, it seems that everything work well on my side(using IE11). Can you post enough code to reproduce the problem? And, you could also F12 developer tools to check the html resource and CSS style(especially the button and it's container's width property).
Besides, you can also change the following code:
<div class="row form-group">
<div class="col-6">
<button type="button" class="btn btn-secondary" (click)="dismiss()">Cancel</button>
<button type="button" class="btn btn-primary" (click)="close()" id="swapImage">Swap</button>
</div>
</div>
to
<div class="row form-group">
<div class="col-3">
<button type="button" class="btn btn-secondary" (click)="dismiss()">Cancel</button>
</div>
<div class="col-3">
<button type="button" class="btn btn-primary" (click)="close()" id="swapImage">Swap</button>
</div>
</div>

Related

How to align my buttons to the right and center the header?

I used the following code to output the interface as shown below.
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-lg-12">
<div class="card m-b-30">
<div class="card-header container-fluid">
<div class="row">
<h2 class="card-title">Customer Profile Types</h2>
<div class="col-md-4 float-right">
<button class="btn btn-primary">Add</button>
<button class="btn btn-primary" style="margin-left: 1em">Update</button>
<button class="btn btn-primary" style="margin-left: 1em">Cancel</button>
</div>
</div>
</div>
<br>
<div class="CustomerProfileTypes-body">
<form>
<div class="form-group row">
<label for="Name" class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="inputText">
<input class="form-check-input" type="checkbox" id="gridCheck">
<label id="gridCheck"> Active</label>
</div>
</div>
</form>
</div>
</div>
</div>
But I need to get the output as shown below and align all the things in my interface.
The name also needs to be centered and textbox, and the checkbox also should be aligned.
I'm still a beginner can anyone help me.
There can be two solutions for the result you are trying to achieve.
Make use of bootstrap columns like you are using right now.
Use flexbox
Solution 1
Make a slight change to your code:
<div class="row">
<div class="col-md-6>
<h2 class="card-title">Customer Profile Types</h2>
</div>
<div class="col-md-6 text-right">
<button class="btn btn-primary">Add</button>
<button class="btn btn-primary" style="margin-left: 1em">Update</button>
<button class="btn btn-primary" style="margin-left: 1em">Cancel</button>
</div>
</div>
Solution 2
Without the bootstrap row and col, pure flexbox (using bootstrap classes).
<div class="d-flex justify-content-between align-items-center">
<h2 class="card-title">Customer Profile Types</h2>
<div>
<button class="btn btn-primary">Add</button>
<button class="btn btn-primary" style="margin-left: 1em">Update</button>
<button class="btn btn-primary" style="margin-left: 1em">Cancel</button>
</div>
</div>
If you want to use CSS, try to use flexbox with property "space-between" on this div (because is father):
<div class="card-header container-fluid">
It should make space between h2 and B's elements.
<div class="col-lg-12" style="padding: 10px">
<div class="card m-b-30">
<div class="card-header container-fluid">
<div class="row">
<h2 class="card-title" style="padding: 10px">Customer Profile Types</h2>
<div align="right" class="col-md-8 float-right">
<button class="btn btn-primary">Add</button>
<button class="btn btn-primary" style="margin-left: 1em">Update</button>
<button class="btn btn-primary" style="margin-left: 1em">Cancel</button>
</div>
</div>
</div>
<br>
<div class="CustomerProfileTypes-body">
<form>
<div class="form-group row">
<label for="Name" class="col-sm-2 col-form-label" style="text-align: center"> Name</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="inputText">
<input class="form-check-input" type="checkbox" id="gridCheck" style="margin-left: 2px" >
<label id="gridCheck" style="margin-left: 15px"> Active </label>
</div>
</div>
</form>
</div>
</div>

Bootstrap buttons/input fields on same line

I'm trying to recreate this example: https://getbootstrap.com/docs/3.3/components/#input-groups-buttons-multiple
Why if I copy this example, with the exact same code I see while inspecting elements, the buttons and input fields are not on the same line?
<body>
<div class="container-fluid">
<form class="bs-example bs-example-form" data-example-id="input-group-multiple-buttons">
<div class="row">
<div class="input-group">
<div class="col-lg-6">
<input class="form-control" aria-label="Text input with multiple buttons">
<div class="input-group-btn">
<button type="button" class="btn btn-default" aria-label="Help"><span
class="glyphicon glyphicon-question-sign"></span></button>
<button type="button" class="btn btn-default">Action</button>
</div>
</div>
</div>
</div>
</form>
</div>
</body>
Fiddle.
You have your column and input group reversed. Typically all content should be inside the column, and the only children of a row should be columns.
<div class="col-lg-6">
<div class="input-group">
Demo

Bootstrap 4 column rows with buttons

I've started to explore Bootstrap 4 and HTML5/CSS in general. I want to create a text area with two buttons on the side (centered horizontally to each other) :
The code I got is the following:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<div class="container mt-2">
<div class="row">
<div class="col-10">
<textarea class="form-control" rows="3" id="sent_text" placeholder="Just write some text.."></textarea>
</div>
<div class="col-2">
<div class="row">
<button class="btn btn-success btn-sm m-1" type="button">Send</button>
</div>
<div class="row">
<button class="btn btn-info btn-sm m-1" type="button">Clear</button>
</div>
</div>
</div>
</div>
I've created a row with 2 columns in it. The second column contains two rows.
Is that correct way to go?
Thanks
A better way of doing it with justify-content-around d-flex flex-column on the buttons column. There was no need of additional row element in the col-2 div.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<div class="container mt-2">
<div class="row">
<div class="col-10">
<textarea class="form-control" rows="3" id="sent_text" placeholder="Just write some text.."></textarea>
</div>
<div class="col-2 justify-content-around d-flex flex-column">
<div>
<button class="btn btn-success btn-sm" type="button">Send</button>
</div>
<div>
<button class="btn btn-info btn-sm" type="button">Clear</button>
</div>
</div>
</div>
I think this method is way better. (:
Use col for the textarea column so that it takes all the available space.
Use col-auto for the buttons column so that it takes as much as space as it needs. And then use d-flex flex-column to change its direction.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<div class="container mt-2">
<div class="row">
<div class="col">
<textarea class="form-control" rows="3" id="sent_text" placeholder="Just write some text.."></textarea>
</div>
<div class="col-auto d-flex flex-column">
<button class="btn btn-success btn-sm m-1" type="button">Send</button>
<button class="btn btn-info btn-sm m-1" type="button">Clear</button>
</div>
</div>
</div>
You should place each button in a div with 'col-...' class.
Bootstrap documentation about nesting elements in a row
Codepen with your example to show you the difference when you use 'col-...' class.
Codepen
<div class="container mt-2">
<div class="row">
<div class="col-10">
<textarea class="form-control" rows="3" id="sent_text"
placeholder="Just write some text.."></textarea>
</div>
<div class="col-2">
<div class="row">
<button class="btn btn-info btn-sm m-1" type="button">Clear</button>
</div>
<div class="row">
<div class="col-12">
<button class="btn btn-success btn-sm m-1" type="button">Send in col</button>
</div>
</div>
<div class="row">
<div class="offset-6 col-6">
<button class="btn btn-success btn-sm m-1" type="button">Send centered using col</button>
</div>
</div>
</div>
Also making the textarea none-reziable is good.Thus
Try this
textarea.form-control{
resize: none;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<div class="container mt-2">
<div class="row">
<div class="col-10">
<textarea class="form-control" rows="3" id="sent_text" placeholder="Just write some text.."></textarea>
</div>
<div class="col-2">
<div class="row">
<div class="d-flex flex-column">
<button class="btn btn-success btn-sm m-1" type="button">Send</button>
<button class="btn btn-info btn-sm m-1" type="button">Clear</button>
</div>
</div>
</div>
</div>
</div>

Make column stretch to fill whatever space it can in Bootstrap

I have this issue:
The html is as follows:
<div class="row">
<div ng-cloak class="col-md-7 col-sm-6 col-xs-12">
<form class="form">
<input type="text" class="form-control" />
</form>
</div>
<div class="col-md-5 col-sm-6 col-xs-12 no-wrap">
<span class="push-buttons-away-from-search-bar btn-group" role="group">
<a class="btn btn-lg" href="">A link</a>
<a class="btn btn-lg" href="">Another link</a>
</span>
</div>
</div>
Can you think of a responsive (bootstrap) way of making the search bartake up all space it can, and leave space for the 2 buttons on the side.
Notice the spacing between the 2 buttons, the button grouping styling was getting in the way... Perhaps you suggest using button groups?
What you're likely looking for, assuming you're using Bootstrap 3, is Justified Buttons. Red: http://getbootstrap.com/components/#btn-groups-justified
Example:
<div class="row">
<div class="col-sm-8">
<input type="text" class="form-control" />
</div>
<div class="col-sm-4">
<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group">
Left
Right
</div>
</div>
</div>
JSFiddle: Note that this can be extended to more than one button.
Update
Since you need the input to scale without the buttons scaling, have you tried Segmented Buttons on an Input Group? Ref: http://getbootstrap.com/components/#input-groups-buttons-segmented
<div class="input-group">
<input type="text" class="form-control" aria-label="...">
<div class="input-group-btn">
<button type="button" class="btn btn-default">Button One</button>
<button type="button" class="btn btn-default">Button Two</button>
<button type="button" class="btn btn-default">Button Three</button>
</div>
</div>
JSFiddle: Note this won't give you a space between the buttons.

Input box in button bar

I am attempting to place a input box in a bootstrap 3 button bar but it is not aligned as expected.
<div class="row">
<div class="col-xs-12">
<div class="btn-toolbar text-center">
<div class="btn-group">
<div class="input-group col-xs-3">
<input type="text" class="form-control">
<span class="input-group-addon">$</span>
</div>
</div>
<div class="btn-group">
<button class="btn btn-default">Button 1</button>
<button class="btn btn-default">Button 2</button>
</div>
</div>
</div>
</div>
It works fine if I use a vanilla input but the buttons in the second btn-group move down to the next row when I attempt to use a input group. Any idea on how I can have them appear on the same row?
Here is a fiddle demonstrating the problem
http://jsfiddle.net/6XST2/
Set the col class to the parent element, the .btn-group. Change this:
<div class="btn-group">
<div class="input-group col-xs-3">
To this:
<div class="btn-group col-xs-3">
<div class="input-group">
Otherwise, the btn-group is filling the whole width.
http://jsfiddle.net/6XST2/3/
try to see this solution
and in this solution you must change the class col-xs-3 to col-xs-12
http://jsfiddle.net/6XST2/1/