Sizes. Fancy larger or smaller buttons? Add .btn-lg or .btn-sm for additional sizes. Create block level buttons—those that span the full width of a parent—by adding .btn-block .
Bootstrap provides four button sizes:
The classes that define the different sizes are:
.btn-lg
.btn-md
.btn-sm
.btn-xs // Removed in Bootstrap 4+
The following example shows the code for different button sizes:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h2>Button Sizes</h2>
<button type="button" class="btn btn-primary btn-lg">Large</button>
<button type="button" class="btn btn-primary btn-md">Medium</button>
<button type="button" class="btn btn-primary btn-sm">Small</button>
</div>
Manually setting the padding in y-direction to 0 and adding an inline-style to reduce the font size gave me an xs-Button in Bootstrap 4:
<input type="submit" value="Submit" class="btn btn-sm btn-outline-primary py-0" style="font-size: 0.8em;">
You can use badge style links, they look and behave like buttons:
.badge-sm {
min-width: 1.8em;
padding: .25em !important;
margin-left: .1em;
margin-right: .1em;
color: white !important;
cursor: pointer;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<label class="mx-1 text-dark">Buttons:</label>
<a href="#" class="badge badge-primary badge-sm" data-scale="hour" data-value="1">1</a>
<a href="#" class="badge badge-danger badge-sm" data-scale="hour" data-value="2">2</a>
You can easily make your buttons smaller using the height
property in Bootstrap 4.
For example:
.btn-sml { height: 4vh; } /* change the value according to your need. */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With