Bootstrap: Removing white-space: nowrap from .btn

Created on 30 Jul 2015  Â·  6Comments  Â·  Source: twbs/bootstrap

Reasons being:

  • this was originally added in https://github.com/twbs/bootstrap/commit/bfc4aaf6e84f20728258672276ccc9db84638082 but even if core .btn class doesn't have nowrap set it will inherit from .input-group-btn
  • on responsive pages it's hard to assure that button copy will always fit available width, making buttons very non-responsive

    • this issue is even more pronounced when working on i18n

    • going with "make shorter labels as to fit design" solution kinda feels like anti-pattern

I found myself overriding this property on almost every Bootstrap project I worked and others had the same issue.

css

Most helpful comment

Is removing white-space: nowrap; going to be considered for V4?

All 6 comments

Yeah, we could probably tweak this. Wonder how many folks are expecting that property and value to be there though after all this time.

Maybe something to consider for v4 then? I think removing that property is very non-destructive change but I see how it can badly impact certain cases.

Yeah punting for consideration in v4.

Is removing white-space: nowrap; going to be considered for V4?

Still in V4 as of now.

Wonder how many folks are expecting that property and value to be there though after all this time.

That's quite possible @mdo, but there are also numerous SO posts (some with many views/upvotes) which deal with how to change this behavior:

I am not sure myself what the correct behavior should be (just like with #24111), I guess it depends on the situation, in some instance you wouldn't want it to go multi-line under any circumstances but in some cases it might be better (also for languages like German you might also want to enable hyphenation).

And even with the current behavior the discussion could be about what to with overflowing text, right now the text overflows into the page unless it's hovered or :active, the rationale for this behavior does not seem obvious to me. BTW, text-overflow: ellipsis is supported in IE10+…

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kamov picture kamov  Â·  3Comments

tiendq picture tiendq  Â·  3Comments

bellwood picture bellwood  Â·  3Comments

alvarotrigo picture alvarotrigo  Â·  3Comments

ziyi2 picture ziyi2  Â·  3Comments