Skip to content

btn's height differs between different tags #11358

Closed
@xavier83ar

Description

I know that this has been reported before, I've read all issues about this bug, but all of them are for 2.x and previous versions, and the newest bug reported is about 1 year's old.

However this bug is still present on bootstrap 3.0.1. I've made a test case to reproduce it, and a possible fix to it.

The issue

Here you can see the issue (screenshot)
https://www.dropbox.com/s/bns0wdl6cmzgmzr/Screenshot%20at%202013-11-04%2010%3A55%3A36.png

Here you can see the real test case:
https://dl.dropboxusercontent.com/u/1715488/bootstrap/btn-height-test.html

Bug fix proposal

I've removed vertical paddings. Instead, I've fixed button's height and line-height. It's been done inside of button-size(...) mixins, this is the result:

// Button sizes
// -------------------------
.button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) {
  @line-height-computed: floor(@font-size * @line-height); // ~20px
  // forzamos el height
  @btn-height: @line-height-computed + 2 * @padding-vertical + 2;

  padding: 0 @padding-horizontal;
  font-size: @font-size;
  line-height: @btn-height - 2;
  height: @btn-height;
  border-radius: @border-radius;
}

Screenshot:
https://www.dropbox.com/s/i8l0kj85xju315q/Screenshot%20at%202013-11-04%2011%3A07%3A09.png

Test case:
https://dl.dropboxusercontent.com/u/1715488/bootstrap/btn-height-fix.html

Notes

I've only tested in chrome, firefox and opera for linux, and only in desktops, but I've been using this method of "zero vertical paddings" for buttons since a few years with excelent results.
In fact I've been using bootstrap since 2.0 and I've always applied a patch to fix this (using this method) without any regressions or other issues, and I know that works ok in windows browsers, ios, and android browsers, but as I said I didn't make any serious test with them.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions