Buttons

BootStrap Button Classes

Bootstrap offers us different button styles. We can apply these styles to tags like a, button, input.

Above, you can see the button classes that BootStrap 3 offers us. At the bottom, you see the Bootstrap 4 buttons.

As you can see, there are some differences between versions 3 and 4, even in styles with the same name.

The .btn selector (class) is used to create a button. E.g;

<a href="#" class="btn" >Buton 1</a>

You can make the button look like one of the above by using the default, primary, success, info, warning, danger, link selectors together with the .btn selector. If you are using BootStrap4 you can also use the light, dark and secondary selectors.

<a href="#" class="btn btn-danger" >Buton 1</a>

Selectors btn-lg, btn-md, btn-sm and btn-xs can be used for different button sizes.

   

<button class="btn btn-success btn-lg" type="button">btn-lg</button>
<button class="btn btn-success btn-md" type="button">btn-md</button>
<button class="btn btn-success btn-sm" type="button">btn-sm</button>
<button class="btn btn-success btn-xs" type="button">btn-xs</button>

.btn-block seçicisi, buton genişliğinin %100 olmasını sağlar.

The .active selector makes the button appear as it was when it was pressed. The .disabled selector disables the button.

 

In BootStrap 4, in addition to all these, unfilled, only bordered (outline) buttons can be used. When hovering over it, the fill color appears:

As you can see, there are many easy-to-apply alternatives for the button.

Do not forget that we can make changes to the appearance of these buttons with our own css codes.

In the topic examples section, there is an example of applying our own styles to bootstrap buttons.

bootstrap buttons, bootstrap, button examples, button, button usage, usage of buttons, button creation, button types, customizing buttons, applying style

EXERCISES

Applying Our Own Styles to BootStrap Buttons Try It

Some of the bootstrap button selectors above have been replaced with the codes written in the style section. Also a class we created (myButton) is applied to the last button.

You can see the codes, change them and examine the result by clicking the try it yourself button.



COMMENTS




Read 593 times.

Online Users: 324



bootstrap-buttons