Bootstrap 3 to Bootstrap 4 converter, migration, changes, difference, update?

Bootstrap 3 to Bootstrap 4 converter, migration, changes, difference, update?

There are some online converters where you can paste the current Bootstrap 3 code and it will make it for Bootstrap 4, but most of the time it will not work properly.

If you are looking to upgrade from Bootstrap 3 to 4, you probably want to have those new colors for the buttons, the well which is now called “card”, the font color etc.

At this time, the official Bootstrap website doesn’t allow us to customize and download only certain parts of Bootstrap 4. And they don’t offer something to overwrite the current code from Boostrap 3.

However, you can do some tweaks that will allow you to change everything you want, very easy.

For example you want to change the old Bootstrap 3 btn-primary to make it look like the one from Bootstrap 4.

Just add this code at the end of the css file or style tag. This will overwrite the Bootstrap 3 btn-default properties.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
.btn-primary {
  color: #fff;
  background-color: #007bff;
  border-color: #007bff;
}
 
.btn-primary:hover {
  color: #fff;
  background-color: #0069d9;
  border-color: #0062cc;
}
 
.btn-primary:focus, .btn-primary.focus {
  box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.5);
}
 
.btn-primary.disabled, .btn-primary:disabled {
  color: #fff;
  background-color: #007bff;
  border-color: #007bff;
}
 
.btn-primary:not(:disabled):not(.disabled):active, .btn-primary:not(:disabled):not(.disabled).active,
.show > .btn-primary.dropdown-toggle {
  color: #fff;
  background-color: #0062cc;
  border-color: #005cbf;
}
 
.btn-primary:not(:disabled):not(.disabled):active:focus, .btn-primary:not(:disabled):not(.disabled).active:focus,
.show > .btn-primary.dropdown-toggle:focus {
  box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.5);
}

Basically, you will want to download the Bootstrap 4 css file (the unminified version), open it in a text editor and with the find function, search for example “btn-primary”. Copy and paste the code you find at the end of your websites’ css code.

Do the same for other classes that you want, btn-danger, btn-info and so on.
Bootstrap 4 doesn’t have btn-default. What you want to do here is to pass the css code from btn-secondary from bootstrap 4 to your current btn-default. Just copy paste the btn-secondary and replace “btn-secondary” with “btn-default”. This is an example.

Here is a code that will get you started. It contains most of the important changes from Bootstrap 3 to Bootstrap 4.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<style>
.btn-primary {
  color: #fff;
  background-color: #007bff;
  border-color: #007bff;
}
 
.btn-primary:hover {
  color: #fff;
  background-color: #0069d9;
  border-color: #0062cc;
}
 
.btn-primary:focus, .btn-primary.focus {
  box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.5);
}
 
.btn-primary.disabled, .btn-primary:disabled {
  color: #fff;
  background-color: #007bff;
  border-color: #007bff;
}
 
.btn-primary:not(:disabled):not(.disabled):active, .btn-primary:not(:disabled):not(.disabled).active,
.show > .btn-primary.dropdown-toggle {
  color: #fff;
  background-color: #0062cc;
  border-color: #005cbf;
}
 
.btn-primary:not(:disabled):not(.disabled):active:focus, .btn-primary:not(:disabled):not(.disabled).active:focus,
.show > .btn-primary.dropdown-toggle:focus {
  box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.5);
}
.list-group-item-info {
  color: #0c5460;
  background-color: #bee5eb;
}
 
.list-group-item-info.list-group-item-action:hover, .list-group-item-info.list-group-item-action:focus {
  color: #0c5460;
  background-color: #abdde5;
}
 
.list-group-item-info.list-group-item-action.active {
  color: #fff;
  background-color: #0c5460;
  border-color: #0c5460;
}
.list-group-item-success {
  color: #155724;
  background-color: #c3e6cb;
}
 
.list-group-item-success.list-group-item-action:hover, .list-group-item-success.list-group-item-action:focus {
  color: #155724;
  background-color: #b1dfbb;
}
 
.list-group-item-success.list-group-item-action.active {
  color: #fff;
  background-color: #155724;
  border-color: #155724;
}
body {
  color: #212529;
}
.well {
  position: relative;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background-color: #fff;
  background-clip: border-box;
  border: 1px solid rgba(0, 0, 0, 0.125);
  border-radius: 0.25rem;
}
a:link, a:visited {
  color: #007bff !important;
}
.pagination > .active > a, .pagination > .active > span, .pagination > .active > a:hover, .pagination > .active > span:hover, .pagination > .active > a:focus, .pagination > .active > span:focus {
    z-index: 3;
    color: #fff;
    background-color: #ccc;
    border-color: #337ab7;
    cursor: default;
}
</style>

One mode thing, the default color link for Bootstrap 4 is #007bff.

If you have any questions, please leave in the comments.

Add a comment: