Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No spacing between bootstrap labels

Tags:

In my application, I am trying to have several conecutive labels, like in this jsbin:

enter image description here

Instead, I am getting this:

enter image description here

As you can see, no spacing is present between the labels. This is probably because of a problem in my CSS, but I am unable to find the culprit.

Where is the spacing between labels defined in bootstrap? Knowing that would allow me to narrow the bug-search in my CSS.

like image 802
blueFast Avatar asked Jun 24 '14 06:06

blueFast


People also ask

How do I add a space between label and textbox in bootstrap?

using . form-group{ margin-bottom: 20px;} works, but best to use bootstrap's builtin and put .

How do I put a space between bootstrap buttons?

To create a toolbar, wrap more button groups into a . btn-toolbar . No spacing is added automatically between the button groups. To add some spacing to your toolbar, use Bootstrap spacing utilities.

What is mX Auto in bootstrap?

Additionally, Bootstrap also includes an .mx-auto class for horizontally centering fixed-width block level content—that is, content that has display: block and a width set—by setting the horizontal margins to auto . Centered element.


2 Answers

This has nothing to do with your CSS at all. Just add a space or break the line between your ".label" tags.

This happened to me when the framework I use started to compress the HTML in order to save some bytes.

You can see this effect on this jsbin.

Bootstrap demo

like image 152
Anderson Freitas Avatar answered Sep 16 '22 15:09

Anderson Freitas


You need to remove the space from inside the label.

The following spans have no space between each other:

<span class="label label-primary"> Primary </span> <span class="label label-default"> Default </span> 

The following spans have the correct spacing between them:

<span class="label label-primary">Primary</span> <span class="label label-default">Default</span> 

Notice that the leading/trailing white space must be removed from inside the span element for them to work correctly.

like image 21
George Filippakos Avatar answered Sep 20 '22 15:09

George Filippakos