Bootstrap button sizes examples

Hi Friends 👋,

Welcome To aGuideHub! ❤️

In this article, I will show to button size examples in bootstrep with step by step guide.

Here, we will use btn-lg, btn-sm, and btn-xs class to make a button in size.

You can very easily change button size by adding btn-lg btn-sm and btn-xs class to it. These classes modify button’s padding and also the font size.

Let’s look at the following example to understand how it basically works:

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <title>Buttons</title>
  </head>
  <body>
<button type="button" class="btn btn-success btn-lg">Large</button>
<button type="button" class="btn btn-primary">Normal</button>
<button type="button" class="btn btn-warning btn-sm">Small</button>
<button type="button" class="btn btn-danger btn-xs">XSmall</button>
    <!-- Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

  </body>
</html>

In the above code, we have used btn-lg btn-sm and btn-xs class to center the button.

Check the output of the above code example.

Bootstrap, button

All the best 👍

Follow me on Twitter