Rayn D Rayn D - 2 months ago 9
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

Bootstrap provides four button sizes:

The classes that define the different sizes are:

.btn-lg
.btn-md
.btn-sm
.btn-xs

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

Comments