html - Chrome 上的占位符故障

标签 html css google-chrome

上下文:

我有一个 <code><input</code>>元素构造如下:

HTML:

<div class="field field-3">
    <span><input type="text" placeholder="Username" name=""></span>
</div>


CSS:
(与 Meyer 在同一样式表中编写的 reset.css 样式表)

.field {
    padding: 20px 10px;
    position: relative;
    overflow: hidden;
}

.field > span {
    background-color: #fff;
    border: 1px solid #bbc3d3;
    float: right;
    padding: 8px 15px;
    position: relative;
}

.field > span input[type="text"] {
    background-color: transparent;
    border: 0 none;
    color: #9da3af;
    display: block;
    font-family: $font-open;
    @include font-size(12px);
    margin: 0;
    outline: 0 none;
    overflow: hidden;
    padding: 3px 0;
    resize: none;
    width: 838px;
    height: 22px;
}


故障:

第一张图片中显示的输入元素占位符。 当我在元素内部单击并写入内容时,文本会向下移动一个像素。

enter image description here

在哪里?

故障仅在谷歌浏览器上显示


问题:我该如何解决并避免这种情况发生?

更新

A koala_web建议,使用jsFiddle ( link ) 来举例说明。
注意:具有讽刺意味的是,在 jsFiddle 中问题没有出现,但我将链接指向出现故障的模板示例 ( link)。

最佳答案

尝试从 style.css 文件的第 297 行中删除行高声明

html, body, button, input, select, textarea {
font-size: 12px;
/*line-height: 1.231; remove this*/
}

关于html - Chrome 上的占位符故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17873538/

相关文章:

javascript - 打印 html 时调整图像大小

html - 文本在 HTML 中的定位问题

node.js - PrintToPDF 无法在 headless Chrome 60 中工作

html - 页面底部的 Bootstrap 页脚

javascript - 除非满足条件,否则 SwiperJS 会阻止 slideNext

javascript - 为什么不以 block 模式显示复选框? - Javascript

css - 周期 2 : is it possible to place the caption above the image?

css - Flexbox 嵌套列

javascript - asbygoogle 导致 chrome 执行脚本永远不会返回

google-chrome - 在较旧的 google chrome 版本中进行测试