html - 文本区域无法解释的间距

标签 html css textarea

我刚刚注意到文本区域下方有一些连线间距,每个浏览器都不同。有人可以解释为什么它在那里吗?

span,
textarea {
    border: 1px solid black;
    margin: 0;
    padding: 0;
}
<textarea></textarea>
<span>test</span>

here is an image of it

最佳答案

添加

vertical-align:bottom

这是因为

The baseline of some replaced elements, like <textarea>, is not specified by the HTML specification, meaning that their behavior with this keyword may change from one browser to the other.

MDN Reference

span,
textarea {
  border: 1px solid black;
  margin: 0;
  padding: 0;
  vertical-align: bottom;
}
<textarea></textarea>
<span>test</span>

关于html - 文本区域无法解释的间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46447431/

相关文章:

javascript - 通过根据内容自动调整高度来防止文本区域 ENTER 行为

jquery - 使用 YouTube Data API 单击缩略图时获取 YouTube videoId

html - 如何添加过渡到 .class :not(:hover)?

html - 多行 html 风格指南

html - 非固定集管的流体高度

html - 粘性 header 始终可见?

html - 将css文件连接到html

javascript - 使用 react-bootstrap 获取输入文本的值

html - 考虑滚动条调整 <div> 宽度

javascript - 文本区域内的文本对齐 IE9