【CSS】IE11浏览器下,文本框中输入汉字后,文本框的位置发生上下偏移的解决方法

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
<form method="post">
  <input type="text" placeholder="中文">
  <input type="submit" value="Submit">
</form>
</body>
</html>

如图,在IE11中打开该网页,在文本框中输入中文,文本框的位置立刻往下偏移1像素。去掉中文后,位置又自动偏移回来了。

解决方法:给文本框设置垂直对齐方式vertical-align就行了。

<input type="text" placeholder="中文" style="vertical-align:top">

猜你喜欢

转载自blog.csdn.net/zlk1214/article/details/80367086