question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.form-control height calculation inconsistent

See original GitHub issue

Problem

Okay, I’m not sure how many people have noticed this behaviour with the .form-control regardless of input type. A decision was made in Bootstrap 4.1.3 to add a fixed height to the .form-control to compensate for differences in computed height across different types (see: https://github.com/twbs/bootstrap/issues/26867), however for me, in most cases the calculation appears to be slightly “off”. It can be most identified with the Email Address field in the Forms component, see: https://getbootstrap.com/docs/4.1/components/forms/#overview

Reproduce

If you inspect the element and simply take off: height: calc(2.25rem + 2px); you’ll see the placeholder text move slightly up and becoming more visually cantered (I picked up on this small thing 😄 )

Still can’t see it? I’ve made a simple illustration (excuse the design skills here, I used paint.net)

example

A = current code and markup found on https://getbootstrap.com/docs/4.1/components/forms/#overview as discussed above.

B = I removed the height: calc(2.25rem + 2px); from my browser.

You’ll see that in the first input (A) there is slightly more spacing between the red line that I’ve added compared to the top of the placeholder text that compared to B which is visually more centred.

Suggestions

I assume that this calculation has come from somewhere, however, I have consistently had this marginal problem on Macbook Safari, Chrome, Windows Chrome and Firefox. I was hoping of some SASS variable that I could edit to overwrite it in my code but couldn’t find one. In fact, more often that not I find myself writing something like the following since 4.1.3:

.form-control {
  height: auto !important;
}

I’d also be curious to know who else is experiencing this and what can be done? 🚀

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
alainbelezcommented, Nov 9, 2018

this is more visible when you have an input-group-append after the input tag, see zoomed image below:

image

2reactions
myplaneticketcommented, Mar 25, 2019

I am having the same issue, but the height: auto makes things misaligned in IE…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows Form - Control position and size change with screen ...
Height / 900;. Then I use SetBounds() to set the bounds of the panel, and in the setbounds I calculate the x,y coordinates...
Read more >
FormControl.heightMode Method (Dynamics.AX.Application)
The height of the control is calculated automatically, and the value parameter is ignored. Column height, The layout of the form determines the...
Read more >
FormControl API - Material UI - MUI
Only one InputBase can be used within a FormControl because it creates visual inconsistencies. For instance, only one input can be focused at...
Read more >
Form controls · Bootstrap v5.0
Set heights using classes like .form-control-lg and .form-control-sm . ... some support for <datalist> elements, their styling is inconsistent at best.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found