问题
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