Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Teachable.

Buttons – Bootstrap

Demo

For the best viewing experience, click the Edit on CodePen button on the upper righthand corner of the Pen to open it in a new tab.

Summary

You can create buttons in Bootstrap using the a element or button element.

Details

To create a button with a solid color, add the btn and btn-primary classes, like this:

<a class="btn btn-primary" href="#" role="button">Link</a>

To create a button with an outline, add the btn and btn-outline-primary classes, like this:

<a class="btn btn-outline-primary" href="#" role="button">Link</a>

To create a large button, add the btn, btn-primary and btn-lg classes, like this:

<a class="btn btn-primary btn-lg" href="#" role="button">Link</a>

To create a small button, add the btn, btn-primary and btn-sm classes, like this:

<a class="btn btn-primary btn-sm" href="#" role="button">Link</a>

Exercises

Recreate the HTML code from the Demo section in your index.html file.

Back to: Bootstrap Reference > Bootstrap Components