Make a smaller bootstrap button

I use bootstrap 3 buttons and I want to resize to a smaller size, I tried using the following which does not work

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

Is there a better way to achieve this?

+16
source share
2 answers

Bootstrap provides four button sizes:

Classes that define different sizes:

.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>
Run codeHide result
+32
source

Bootstrap 4 does not support xs, here we can only use the "btn-sm" class for a small icon.

<a class="btn btn-info btn-sm"href="#"><i class="fa fa-edit fa-fw"></i></a>
0
source

Source: https://habr.com/ru/post/1655450/


All Articles