3

I use the following to replace hidden input since hidden input can not get focus:

  <input style="height:0;width:0;padding:0;border:none" type="text" />

The input element has a certain spaces on screen. Look at debugger, it has zero size and no margin, no padding, no borders.

Thanks for help.

Dave
  • 759
  • 2
  • 9
  • 31

1 Answers1

3

This has been answered by another related question here: Why does inline-block cause this div to have height?

Long story short: Input elements usually default to display: inline-block; and inline-block input elements respect the line-height of thier parent element over their own height. You can force it to respect height: 0; by changing the input to display: block; or alternatively by giving its parent line-height: 0;.

pschueller
  • 4,362
  • 2
  • 27
  • 50