0

I'm trying to figure out how to seperate buttons which shown below using some spaces like margin with Bootstrap 4.1. I tried btn-toolbar on the wrapper div also wrapped each button with btn-group but no way to get a result.

Is there an easy way to handle this with Bootstrap 4.1 or Should i use some css?

<!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://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
</head>
<body>
  
<div class="container">
  <button _ngcontent-c5="" class="btn btn-success" type="submit">Add</button><button _ngcontent-c5="" class="btn btn-danger" type="button">Delete</button><button _ngcontent-c5="" class="btn btn-primary" type="button">Clear</button> 
</div>
</body>
</html>
harun
  • 43
  • 9

1 Answers1

3

Use the spacing utils. For example mr-1 means margin right 1 spacer unit...

<div class="container">
  <button _class="btn btn-success mr-1" type="submit">Add</button><button class="btn btn-danger mr-1" type="button">Delete</button><button  class="btn btn-primary" type="button">Clear</button> 
</div>

Related: How do I use the Spacing Utility Classes on Bootstrap 4

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
  • Thanks. Its easy to use and should i need the **btn-toolbar** on the wrapper div? – harun Dec 07 '18 at 13:19
  • No need if you want each button with it's own rounded border on all sides. – Carol Skelly Dec 07 '18 at 13:22
  • Thank you so much. I was starting to get crazy, seeing example with spaces without figuring out how to do it! I don't get why the space are not by default... – Claire Dec 10 '18 at 09:46