html - 当 <input> 标签上的 "-webkit-appearance: none"和值 =""时,Chrome 中的高度不正确

标签 html css google-chrome webkit

在 Windows 7 上的 Chrome v17.0.963.79 中,我在应用 -webkit-appearance: none 时似乎遇到了莫名其妙的问题。风格 <input>标签。问题如下:

我有一个样式表,我们称它为 potatofoot.css,它由代码组成

.tbl {
    display: table;
}

.tblRow {
    display: table-row;
}

.tblCell {
    display: table-cell;
}

input {
    -webkit-appearance: none;
}​

我有一个 html 文件,我们称它为 blech.html,其中包含代码

<div class="tbl">

  <div class="tblRow">
    <label class="tblCell">Name</label>
    <input type="text" class="tblCell" value="I'M NOT EMPTY! OH, YEAH!">
  </div><!--end tblRow-->

</div><!--end tbl-->

这显示正常(参见 this jsfiddle )。但是当我清空 value属性,如 this jsfiddle ,整个表格从26px的高度增长到31px的高度,label移动到底部,input停留在顶部。

但是,如果我删除 -webkit-appearance: none; , 一切都显示相同 withwithout输出正在填充的值属性。

这是怎么回事?

最佳答案

使用 Chrome 开发者工具对其进行了测试 - 体验相同。

发生的事情是使用 -webkit-appearance: none 似乎在内部设置了 display: table-cell

如果您通过设置 display: inline-block 覆盖它(因为它是 without -webkit-appearance: none)它会显示正确。

关于html - 当 &lt;input&gt; 标签上的 "-webkit-appearance: none"和值 =""时,Chrome 中的高度不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9796538/

相关文章:

javascript - 字符串上下文中的新日期在 Firefox 中不起作用

html - CSS 渐变按钮在 Chrome 和 Firefox 之间显示不同

html - 在 Chrome 开发工具中使用媒体查询

asp.net - 如何覆盖 site.master 页面中的部分样式?

php - 如何解决未定义索引的问题

html - 从 word 复制/粘贴到 html

html - 显示 Accordion 内容

css - 100vh 上的背景封面图像 - 屏幕差异

html - iPhone 上的 Div 宽度和问题

css - 为什么IE6和IE7没有完全显示这个div?