2017-02-14 36 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