Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap CSS space between buttons in navbar

How can I make space between buttons in navbar? I usually do that with  but it doesn't work now. Here's an JSfiddle of how it looks:

http://jsfiddle.net/W6hEa/

like image 264
dynamitem Avatar asked Aug 05 '13 18:08

dynamitem


People also ask

How do you put a space between buttons in bootstrap 5?

You can achieved by use bootstrap Spacing. Bootstrap Spacing includes a wide range of shorthand responsive margin and padding. In below example mr-1 set the margin or padding to $spacer * .

How do I add spaces between navbar items?

As of Bootstrap 4, you can use the spacing utilities. Add for instance px-2 in the classes of the nav-item to increase the padding.

How do you put a space between two CSS buttons?

In CSS, select the B1 class and set its margin-right property to 4px . This will create a 4px space to Button 1 right, creating a space between the two buttons.


2 Answers

you may try margin-left

here is the code

.btn{
margin-left:10px;
}

here is the example:: FIDDLE

like image 193
Ritabrata Gautam Avatar answered Sep 27 '22 18:09

Ritabrata Gautam


Copy & paste this to your style.css and assign it as class attribute:

.btn-margin-left {
    margin-left: 2px;
}
.btn-margin-right {
    margin-right: 2px;
}

Usage

<a href="URL" class="btn btn-default btn-sm btn-margin-left">Link</a>

<button type="button" class="btn btn-default btn-sm btn-margin-left">Button</button>
like image 34
Jens A. Koch Avatar answered Sep 27 '22 18:09

Jens A. Koch