HTML输入文本光标位置问题

时间:2017-02-14 04:16:13

标签: html css input

只想请求你的帮助。加载html页面时,输入文本上的光标太高或位置错误:

enter image description here

但是在焦点上时,输入文本光标是正确的:

enter image description here

在此处发现了另一个相同的问题,但line-height修复程序无法解决我的问题。

的CSS:

input[type=text] {
    border-radius: 0 !important;
    height: 50px !important;
    font-size: 14px !important;
    box-shadow: none !important;
    line-height: 100% !important;
}

2 个答案:

答案 0 :(得分:1)

这是填充问题。当你点击输入fiend时,它会被聚焦,然后它会得到一个填充,所以光标处于正确的位置。所以设置填充如下 -

input[type=text] {
    border-radius: 0 !important;
    height: 50px !important;
    font-size: 14px !important;
    box-shadow: none !important;
    line-height: 100% !important;
    padding: adjust according to your choice;
}

答案 1 :(得分:0)

尝试

line-height: normal;

通常它有助于解决类似问题。