2017-02-14 81 views
0

只想索要你的帮助。当HTML页面加载时,在输入文字光标太高或在错误的位置: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; 
} 
+0

请包括所有代码,以便我们有[mcve]。 –

回答

1

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

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; 
} 
+0

仍然无法正常工作,我决定根据光标减少行高,但这不是解决方案。 – hensonmel