html中input类型为text和password的长度不一样问题的解决方案

在使用IE内核的浏览器中,input标签采用如下形式,会造成text类型和password类型标签不一样长

<input type="text" size="10">

<input type="password" size="10">

造成这种问题的原因为:密码默认都用*代替了文字,所以肯定是比文本占用的空间小。

解决办法:用CSS定义input标签的长和高就不会出现上述问题。实例标签如下:

<input type="text" size="10" name="username" style="120px;height:16">

<input type="password" size="10" name="password" style="120px;height:16">

原文地址:https://www.cnblogs.com/yxfcnbg/p/3053265.html