I'm using Bootstrap in my Angular application and all other styles are working like they should, but checkbox style doesn't. It just look like plain old checkbox.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">_x000D_
<div class="container">_x000D_
<form class="form-signin">_x000D_
<h2 class="form-signin-heading">Please log in</h2>_x000D_
<label for="inputEmail" class="sr-only">User name</label>_x000D_
<input [(ngModel)]="loginUser.Username" type="username" name="username" id="inputEmail" class="form-control" placeholder="User name" required autofocus>_x000D_
<label for="inputPassword" class="sr-only">Password</label>_x000D_
<input [(ngModel)]="loginUser.Password" type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>_x000D_
<a *ngIf="register == false" (click)="registerState()">Register</a>_x000D_
<div class="checkbox">_x000D_
<label>_x000D_
<input type="checkbox" [(ngModel)]="rememberMe" name="rememberme"> Remember me_x000D_
</label>_x000D_
</div>_x000D_
<button *ngIf="register == false" (click)="login()" class="btn btn-lg btn-primary btn-block" type="submit">Log in</button>_x000D_
</form>_x000D_
</div>
_x000D_
What it looks like:
What I want it to look like with Bootstrap style:
This question is related to
css
twitter-bootstrap
checkbox
Here you have an example styling checkboxes and radios using Font Awesome 5 free[
/*General style*/_x000D_
.custom-checkbox label, .custom-radio label {_x000D_
position: relative;_x000D_
cursor: pointer;_x000D_
color: #666;_x000D_
font-size: 30px;_x000D_
}_x000D_
.custom-checkbox input[type="checkbox"] ,.custom-radio input[type="radio"] {_x000D_
position: absolute;_x000D_
right: 9000px;_x000D_
}_x000D_
/*Custom checkboxes style*/_x000D_
.custom-checkbox input[type="checkbox"]+.label-text:before {_x000D_
content: "\f0c8";_x000D_
font-family: "Font Awesome 5 Pro";_x000D_
speak: none;_x000D_
font-style: normal;_x000D_
font-weight: normal;_x000D_
font-variant: normal;_x000D_
text-transform: none;_x000D_
line-height: 1;_x000D_
-webkit-font-smoothing: antialiased;_x000D_
width: 1em;_x000D_
display: inline-block;_x000D_
margin-right: 5px;_x000D_
}_x000D_
.custom-checkbox input[type="checkbox"]:checked+.label-text:before {_x000D_
content: "\f14a";_x000D_
color: #2980b9;_x000D_
animation: effect 250ms ease-in;_x000D_
}_x000D_
.custom-checkbox input[type="checkbox"]:disabled+.label-text {_x000D_
color: #aaa;_x000D_
}_x000D_
.custom-checkbox input[type="checkbox"]:disabled+.label-text:before {_x000D_
content: "\f0c8";_x000D_
color: #ccc;_x000D_
}_x000D_
_x000D_
/*Custom checkboxes style*/_x000D_
.custom-radio input[type="radio"]+.label-text:before {_x000D_
content: "\f111";_x000D_
font-family: "Font Awesome 5 Pro";_x000D_
speak: none;_x000D_
font-style: normal;_x000D_
font-weight: normal;_x000D_
font-variant: normal;_x000D_
text-transform: none;_x000D_
line-height: 1;_x000D_
-webkit-font-smoothing: antialiased;_x000D_
width: 1em;_x000D_
display: inline-block;_x000D_
margin-right: 5px;_x000D_
}_x000D_
_x000D_
.custom-radio input[type="radio"]:checked+.label-text:before {_x000D_
content: "\f192";_x000D_
color: #8e44ad;_x000D_
animation: effect 250ms ease-in;_x000D_
}_x000D_
_x000D_
.custom-radio input[type="radio"]:disabled+.label-text {_x000D_
color: #aaa;_x000D_
}_x000D_
_x000D_
.custom-radio input[type="radio"]:disabled+.label-text:before {_x000D_
content: "\f111";_x000D_
color: #ccc;_x000D_
}_x000D_
_x000D_
@keyframes effect {_x000D_
0% {_x000D_
transform: scale(0);_x000D_
}_x000D_
25% {_x000D_
transform: scale(1.3);_x000D_
}_x000D_
75% {_x000D_
transform: scale(1.4);_x000D_
}_x000D_
100% {_x000D_
transform: scale(1);_x000D_
}_x000D_
}
_x000D_
<script src="https://kit.fontawesome.com/2a10ab39d6.js"></script>_x000D_
<div class="col-md-4">_x000D_
<form>_x000D_
<h2>1. Customs Checkboxes</h2>_x000D_
<div class="custom-checkbox">_x000D_
<div class="form-check">_x000D_
<label>_x000D_
<input type="checkbox" name="check" checked> <span class="label-text">Option 01</span>_x000D_
</label>_x000D_
</div>_x000D_
<div class="form-check">_x000D_
<label>_x000D_
<input type="checkbox" name="check"> <span class="label-text">Option 02</span>_x000D_
</label>_x000D_
</div>_x000D_
<div class="form-check">_x000D_
<label>_x000D_
<input type="checkbox" name="check"> <span class="label-text">Option 03</span>_x000D_
</label>_x000D_
</div>_x000D_
<div class="form-check">_x000D_
<label>_x000D_
<input type="checkbox" name="check" disabled> <span class="label-text">Option 04</span>_x000D_
</label>_x000D_
</div>_x000D_
</div>_x000D_
</form>_x000D_
</div>_x000D_
<div class="col-md-4">_x000D_
<form>_x000D_
<h2>2. Customs Radios</h2>_x000D_
<div class="custom-radio">_x000D_
_x000D_
<div class="form-check">_x000D_
<label>_x000D_
<input type="radio" name="radio" checked> <span class="label-text">Option 01</span>_x000D_
</label>_x000D_
</div>_x000D_
<div class="form-check">_x000D_
<label>_x000D_
<input type="radio" name="radio"> <span class="label-text">Option 02</span>_x000D_
</label>_x000D_
</div>_x000D_
<div class="form-check">_x000D_
<label>_x000D_
<input type="radio" name="radio"> <span class="label-text">Option 03</span>_x000D_
</label>_x000D_
</div>_x000D_
<div class="form-check">_x000D_
<label>_x000D_
<input type="radio" name="radio" disabled> <span class="label-text">Option 04</span>_x000D_
</label>_x000D_
</div>_x000D_
</div>_x000D_
</form>_x000D_
</div>
_x000D_
As others have said, the style you're after is actually just the Mac OS checkbox style, so it will look radically different on other devices.
In fact both screenshots you linked show what checkboxes look like on Mac OS in Chrome, the grey one is shown at non-100% zoom levels.
You have to use Bootstrap version 4 with the custom-*
classes to get this style:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
_x000D_
<!-- example code of the bootstrap website -->_x000D_
<label class="custom-control custom-checkbox">_x000D_
<input type="checkbox" class="custom-control-input">_x000D_
<span class="custom-control-indicator"></span>_x000D_
<span class="custom-control-description">Check this custom checkbox</span>_x000D_
</label>_x000D_
_x000D_
<!-- your code with the custom classes of version 4 -->_x000D_
<div class="checkbox">_x000D_
<label class="custom-control custom-checkbox">_x000D_
<input type="checkbox" [(ngModel)]="rememberMe" name="rememberme" class="custom-control-input">_x000D_
<span class="custom-control-indicator"></span>_x000D_
<span class="custom-control-description">Remember me</span>_x000D_
</label>_x000D_
</div>
_x000D_
Documentation: https://getbootstrap.com/docs/4.0/components/forms/#checkboxes-and-radios-1
Custom checkbox style on Bootstrap version 3?
Bootstrap version 3 doesn't have custom checkbox styles, but you can use your own. In this case: How to style a checkbox using CSS?
These custom styles are only available since version 4.
/* The customcheck */_x000D_
.customcheck {_x000D_
display: block;_x000D_
position: relative;_x000D_
padding-left: 35px;_x000D_
margin-bottom: 12px;_x000D_
cursor: pointer;_x000D_
font-size: 22px;_x000D_
-webkit-user-select: none;_x000D_
-moz-user-select: none;_x000D_
-ms-user-select: none;_x000D_
user-select: none;_x000D_
}_x000D_
_x000D_
/* Hide the browser's default checkbox */_x000D_
.customcheck input {_x000D_
position: absolute;_x000D_
opacity: 0;_x000D_
cursor: pointer;_x000D_
}_x000D_
_x000D_
/* Create a custom checkbox */_x000D_
.checkmark {_x000D_
position: absolute;_x000D_
top: 0;_x000D_
left: 0;_x000D_
height: 25px;_x000D_
width: 25px;_x000D_
background-color: #eee;_x000D_
border-radius: 5px;_x000D_
}_x000D_
_x000D_
/* On mouse-over, add a grey background color */_x000D_
.customcheck:hover input ~ .checkmark {_x000D_
background-color: #ccc;_x000D_
}_x000D_
_x000D_
/* When the checkbox is checked, add a blue background */_x000D_
.customcheck input:checked ~ .checkmark {_x000D_
background-color: #02cf32;_x000D_
border-radius: 5px;_x000D_
}_x000D_
_x000D_
/* Create the checkmark/indicator (hidden when not checked) */_x000D_
.checkmark:after {_x000D_
content: "";_x000D_
position: absolute;_x000D_
display: none;_x000D_
}_x000D_
_x000D_
/* Show the checkmark when checked */_x000D_
.customcheck input:checked ~ .checkmark:after {_x000D_
display: block;_x000D_
}_x000D_
_x000D_
/* Style the checkmark/indicator */_x000D_
.customcheck .checkmark:after {_x000D_
left: 9px;_x000D_
top: 5px;_x000D_
width: 5px;_x000D_
height: 10px;_x000D_
border: solid white;_x000D_
border-width: 0 3px 3px 0;_x000D_
-webkit-transform: rotate(45deg);_x000D_
-ms-transform: rotate(45deg);_x000D_
transform: rotate(45deg);_x000D_
}
_x000D_
<div class="container">_x000D_
<h1>Custom Checkboxes</h1></br>_x000D_
_x000D_
<label class="customcheck">One_x000D_
<input type="checkbox" checked="checked">_x000D_
<span class="checkmark"></span>_x000D_
</label>_x000D_
<label class="customcheck">Two_x000D_
<input type="checkbox">_x000D_
<span class="checkmark"></span>_x000D_
</label>_x000D_
<label class="customcheck">Three_x000D_
<input type="checkbox">_x000D_
<span class="checkmark"></span>_x000D_
</label>_x000D_
<label class="customcheck">Four_x000D_
<input type="checkbox">_x000D_
<span class="checkmark"></span>_x000D_
</label>_x000D_
</div>
_x000D_
Source: Stackoverflow.com