Development

Creating a custom Bootstrap button class

As you may know Bootstrap comes with several styles of buttons or if you use a Bootswatch theme you can get many more styles. But in most cases you will want your own and here is how to style a Bootstrap button to your liking:

The CSS:

.btn-custom { 
  color: #ffffff; 
  background-color: #FF8103; 
  border-color: #000000; 
} 
 
.btn-custom:hover, 
.btn-custom:focus, 
.btn-custom:active, 
.btn-custom.active, 
.open .dropdown-toggle.btn-custom { 
  color: #ffffff; 
  background-color: #FFBE0D; 
  border-color: #000000; 
} 
 
.btn-custom:active, 
.btn-custom.active, 
.open .dropdown-toggle.btn-custom { 
  background-image: none; 
} 
 
.btn-custom.disabled, 
.btn-custom[disabled], 
fieldset[disabled] .btn-custom, 
.btn-custom.disabled:hover, 
.btn-custom[disabled]:hover, 
fieldset[disabled] .btn-custom:hover, 
.btn-custom.disabled:focus, 
.btn-custom[disabled]:focus, 
fieldset[disabled] .btn-custom:focus, 
.btn-custom.disabled:active, 
.btn-custom[disabled]:active, 
fieldset[disabled] .btn-custom:active, 
.btn-custom.disabled.active, 
.btn-custom[disabled].active, 
fieldset[disabled] .btn-custom.active { 
  background-color: #FF8103; 
  border-color: #000000; 
} 
 
.btn-custom .badge { 
  color: #FF8103; 
  background-color: #ffffff; 
}

Choose your colors obviously, to use this custom button just use the class btn-custom

Button text

To do more custom buttons just copy the CSS above and change the colors stated.

 

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago