Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

button-group rely on whitespace for inbetween spacing #359

Open
stepandersen opened this issue May 9, 2019 · 3 comments
Open

button-group rely on whitespace for inbetween spacing #359

stepandersen opened this issue May 9, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@stepandersen
Copy link

stepandersen commented May 9, 2019

Buttons in button-group (or just two sibling buttons really) are rendered with spacing inbetween because there is a white-space character there. (In code that white-space is actually a line-break and maybe a couple of tabs.)

<div class="button-group">
  <button class="btn btn-primary" type="button">Primary</button>
  <button class="btn btn-secondary" type="button">Secondary</button>
  <button class="btn btn-danger" type="button">Danger</button>
</div>

image

Minifiers remove these white-spaces and the buttons are rendered like:
image

Some potential solutions:
https://css-tricks.com/fighting-the-space-between-inline-block-elements/

@Akswii
Copy link
Contributor

Akswii commented May 9, 2019

So intended behavior should be no white-space and fix "air" between the buttons with margin?

@stepandersen
Copy link
Author

Yes, the buttons should have the same spacing inbetween regardless of white-spaces.
I suppose margin-right and margin-left makes the most sense, even though DesignGuide doesn't recommend right aligned buttons.

Something like this perhaps:

.button-group {
  display: flex;
}
.button-group .btn {
  margin-left: 2px;
  margin-right: 2px;
}
.button-group .btn:first-child {
  margin-left: 0;
}
.button-group .btn:last-child {
  margin-right: 0;
}

@Akswii Akswii added the enhancement New feature or request label May 20, 2019
@Akswii
Copy link
Contributor

Akswii commented May 20, 2019

We see the need to support compiled templates, and like your solution. But need to add flex-wrap:wrap and consider if we are going to solve this issue for buttons not wrapped in a .button-group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants