为什么修改textarea的text-align:center;在chrome中显示不正常,而在其他浏览器显示正常?

为什么修改textarea的text-align:center;在chrome中显示不正常,而在其他浏览器显示正常?

以下是代码

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<style>
html{margin:0 auto;text-align:center;}
body{max-width: 900px;margin:0 auto;}
textarea{width:200px;height: 200px;}
button {width: 200px;text-align: center;}
.div1{width:200px;height:200px;background-color: aqua;margin: 0 auto;}
</style>
</head>
<body>
<div ><textarea  title="leaveMessage" Class="formInput"  name="leaveWords"></textarea>
<br>
<button class="formButton">    留言</button>
<div class="div1"><p>you need cry dear</p></div>
</div>
</body>

在火狐是这样的
这是火狐浏览器
在chrome却是这样的
这是chrome
其他浏览器都是正常的或者差异不明显的
这是EDGE
这是IE

而且无论采取何种布局,textarea永远会多出一点点。
why?为什么会这样?是我的浏览器出问题 了吗?

阅读 3.8k
1 个回答

textarea默认自带padding和border

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题