Move the cursor for input text to the right

流过昼夜 提交于 2021-02-17 05:09:37

问题


I want the the point at which a user types text into a textfield to be moved to the right without moving the margin of the text field to the right. I want this because the search button lies on top of the text field for styling purposes and currently when a user begins to type text it starts underneath the search button. So I need the default point of the cursor to be moved to the right by a few pixels. Is this possible with CSS?


回答1:


I would definately use

text-indent: 20px;

=)




回答2:


Padding is what you are looking for.

.search-box{padding-left: 25px;}



回答3:


input {
    box-sizing: border-box;
    padding-left: 10px;
    width: 200px;
}
<input type="text" />


来源:https://stackoverflow.com/questions/32039928/move-the-cursor-for-input-text-to-the-right

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!