How to change the shape of a Bootstrap button

How to change the default round corner button in bootstrap to a regular rectangle button? Now I can only change the color or font of the button

.btn-lg {
  padding: 10px 16px;
  font-size: 18px;
  line-height: 1.33;
  border-radius: 6px;
}

.btn-sm,
.btn-xs {
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 3px;
}
Run codeHide result

Appreciate your help

+4
source share
2 answers

The best practice is to create a custom class so that you don’t change the underlying CSS in case you want to use it elsewhere and then apply your changes.

In the example, I use .btn.btn-custom-lg, .btn.btn-custom-sm, .btn.btn-custom-xs, but if you want to change something like buttons border-radiusfor everyone, you can make one global class apply to the button:.btn-square { border-radius: 0; }

See a working example.

/*Specific Cases*/

.btn.btn-custom-lg,
.btn.btn-custom-sm,
.btn.btn-custom-xs {
  border-radius: 0;
}
/*Global*/

.btn.btn-square {
  border-radius: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">

  <hr>
  <h3>Specific</h3>
  <div class="btn btn-default btn-lg btn-custom-lg">Button Default</div>
  <div class="btn btn-default btn-sm btn-custom-sm">Button Default</div>
  <div class="btn btn-default btn-xs btn-custom-xs">Button Default</div>
  <hr>
  <h3>Global</h3>
  <div class="btn btn-default btn-lg btn-square">Button Default</div>
  <div class="btn btn-default btn-sm btn-square">Button Default</div>
  <div class="btn btn-default btn-xs btn-square">Button Default</div>
</div>
Run codeHide result
+5

rounded-0, GetBootstrap.com:

<a href="tel:+447447218297" class="btn btn-lg btn-success rounded-0"><img src="">Call Now</a>
-1

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


All Articles