Bootstrap: Floating label example has misaligned label due to change of height of inputs

Created on 1 Aug 2018  路  7Comments  路  Source: twbs/bootstrap

I was thinking of using the floating label on my website, but it appears to have been changed :-(

4.0 (https://getbootstrap.com/docs/4.0/examples/floating-labels/):
image

4.1 (https://getbootstrap.com/docs/4.1/examples/floating-labels/):
image

Actually I think that the changes happened when 4.1.3 was released and a fixed height of 38px was introduced as it goes from 50px (calculated) to 38px (set):
image

image

css examples has-pr v4

All 7 comments

Thanks!

To recap the other issue, this is because we added fixed height to .form-control in v4.1.3. Will need to override it here.

Keeping the standard 38px for input heights, I have come to that these adjustments work nicely:
image
and:
image
That results to:
image
and:
image

Use it for inspiration :-)

Please also consider to support/implement floating label for textarea. If 'expanding' the css to also cover textarea, the alignment with the above values are a little bit off, but only a little:
image

How do we get back the 50px (calculated) for floating labels?

Ideally we shouldn't require a fixed/specific height but the code should adjust accordingly to the height of the input/textarea

Yeah, i removed the height entirely and got what i wanted. I think i agree with you about not having fixed/specific height

See the PR where we added the height for why: #26820. We need to account for it here by providing a new height.

@mdo will the fix/adjustment be a part of 4.2?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

devfrey picture devfrey  路  3Comments

knownasilya picture knownasilya  路  3Comments

ziyi2 picture ziyi2  路  3Comments

bellwood picture bellwood  路  3Comments

eddywashere picture eddywashere  路  3Comments