Rayn D Rayn D - 1 year ago 135
CSS Question

Make smaller button in bootstrap

I use bootstrap 3 buttons and I want to modify the size to smaller, I've tried with the following which doesn't work

.btn-sml {
padding: 10px 10px;
font-size: 22px;
border-radius: 8px;

There is a better way to achieve this ?

Answer Source

Bootstrap provides four button sizes:

The classes that define the different sizes are:


The following example shows the code for different button sizes:

<!DOCTYPE html>
<html lang="en">
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<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>
  <button type="button" class="btn btn-primary btn-xs">XSmall</button>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download